更改webpack.config.js(CRA2)中的条目

时间:2019-06-28 22:29:35

标签: javascript node.js webpack

弹出后,我需要更改主条目,但是在CRA2中,我仅在path.js中看到相对路径

entry: [
  // the line below with these two lines if you prefer the stock client:
  // require.resolve('webpack-dev-server/client') + '?/',
  // require.resolve('webpack/hot/dev-server'),
  isEnvDevelopment &&
    require.resolve('react-dev-utils/webpackHotDevClient'),
  // Finally, this is your app's code:
  paths.appIndexJs,
  // We include the app code last so that if there is a runtime error during
  // initialization, it doesn't blow up the WebpackDevServer client, and
  // changing JS code would still trigger a refresh.
].filter(Boolean)`

我在path.js中拥有部分路径

dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/client/index'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src/client'),
appTsConfig: resolveApp('tsconfig.json'),
appJsConfig: resolveApp('jsconfig.json'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveModule(resolveApp, 'src/client/setupTests'),
proxySetup: resolveApp('src/server/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
};

最后,我需要将src / index.js更改为src / client / index.js 但是我仍然有错误

Error: ENOENT: no such file or directory, open
/Users/home/Documents/Programming/making_waves/src/index.js

给我一​​个机会来更改Webpack设置

0 个答案:

没有答案