Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack设置了vendor后,build会报错,webpack-dev-server不会 #60

Open
UntilGone opened this issue Apr 15, 2021 · 0 comments
Open

Comments

@UntilGone
Copy link

webpack config:

const vendors = [
  'antd',
  'react',
  'react-dom',
  'react-router-dom',
  '@reduxjs/toolkit',
  'react-redux',
  'axios',
  'redux-saga',
  'dayjs',
];
webpackConfig = {
  ...,
  entry: {
    vendor: vendors,
    index: {
      import: path.resolve(__dirname, '../src/index.tsx'),
      dependOn: 'vendor',
    },
  },
}

设置了vendor后,build会报错,但是webpack-dev-server本地跑就不会有问题。
报错如下:
Error: Entry index depends on ${本地路径}/node_modules/antd-dayjs-webpack-plugin/src/init-dayjs-webpack-plugin-entry.js, but this entry was not found
at Compilation.seal (${本地路径}/node_modules/webpack/lib/Compilation.js:2310:13)
at ${本地路径}/node_modules/webpack/lib/Compiler.js:1080:20
at ${本地路径}/node_modules/webpack/lib/Compilation.js:2186:4
at _next2 (eval at create (${本地路径}/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), :35:1)
at eval (eval at create (${本地路径}/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), :71:1)
at ${本地路径}/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:374:11
at ${本地路径}/node_modules/neo-async/async.js:2830:7
at Object.each (${本地路径}/node_modules/neo-async/async.js:2850:39)
at ${本地路径}/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:353:18
at ${本地路径}/node_modules/neo-async/async.js:2830:7

如果取消vendor就不会有问题。
请问下是vendor的原因还是我vendor配置的原因呢,或者我应该怎么排查这个问题哇。
我去报错的文件里打了一些log,对比了本地运行和build的内容,看起来是一样的。麻烦大佬空了看看。如果需要完整webpack配置的话,我再贴。目前自己测试来看,应该是vendor的原因。
先谢谢大佬的插件和指导 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant