본문 바로가기

실전 단아 개발 가이드

Error: Cannot find module 'C:\myfront\viw/config-overrides'

반응형

 

npm i react-app-rewired

 

실패

 

 

 

 

yarn add url webpack-cli stream-http stream-browserify react-app-rewired os-browserify os https-browserify fs crypto-browserify buffer assert process

 

 

 

config-overrides.js 생성
root 경로(package.json과 같은 위치)에 config-overrides.js를 생성한다.

 

// config-overrides.js
module.exports = {
  // The Webpack config to use when compiling your react app for development or production.
  webpack: function (config, env) {
    const overridedConfig = {
      ...config,
      resolve: {
        ...config.resolve,
        fallback: {
          ...config.resolve.fallback,
          fs: false,
          net: false,
          stream: require.resolve('stream-browserify'),
          crypto: require.resolve('crypto-browserify'),
          http: require.resolve('stream-http'),
          https: require.resolve('https-browserify'),
          os: require.resolve('os-browserify/browser'),
          url: require.resolve('url'),
        },
      },
    };
    return overridedConfig;
  },
};
반응형