webpack 从Angular 12升级到14导致故事书错误:TypeError:“compilation”参数必须是Compilation的示例

0s7z1bwu  于 2023-01-13  发布在  Webpack
关注(0)|答案(1)|浏览(244)

我的Angular 12构建是使用webpack 5来构建故事书。我升级到Angular 13,然后到14,突然同样的故事书构建失败了

TypeError: The 'compilation' argument must be an instance of Compilation

我尝试过直接安装webpack,并且尝试过为webpack添加一个overrides部分以将其锁定在5.75.0。我发现的所有内容都指向冲突的webpack版本,但npm ls webpack现在返回的输出与它在我的angular 12 build中工作时相同:

├─┬ @angular-devkit/build-angular@14.2.10
│ ├─┬ @angular-devkit/build-webpack@0.1402.10
│ │ └── webpack@5.75.0 deduped
│ ├─┬ @ngtools/webpack@14.2.10
│ │ └── webpack@5.75.0 deduped
│ ├─┬ babel-loader@8.2.5
│ │ └── webpack@5.74.0 deduped
│ ├─┬ copy-webpack-plugin@11.0.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ css-loader@6.7.1
│ │ └── webpack@5.75.0 deduped
│ ├─┬ less-loader@11.0.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ mini-css-extract-plugin@2.6.1
│ │ └── webpack@5.75.0 deduped
│ ├─┬ postcss-loader@7.0.1
│ │ └── webpack@5.75.0 deduped
│ ├─┬ sass-loader@13.0.2
│ │ └── webpack@5.75.0 deduped
│ ├─┬ source-map-loader@4.0.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ stylus-loader@7.0.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ webpack-dev-middleware@5.3.3
│ │ └── webpack@5.75.0 deduped
│ ├─┬ webpack-dev-server@4.11.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ webpack-subresource-integrity@5.1.0
│ │ └── webpack@5.75.0 deduped
│ └── webpack@5.74.0
├─┬ @cypress/webpack-preprocessor@5.16.0
│ ├─┬ babel-loader@8.3.0
│ │ └── webpack@5.75.0 deduped
│ └── webpack@5.75.0 deduped
├─┬ @storybook/addon-essentials@6.5.14
│ └─┬ @storybook/core-common@6.5.14
│   ├─┬ fork-ts-checker-webpack-plugin@6.5.2
│   │ └── webpack@4.46.0 deduped
│   └─┬ webpack@4.46.0
│     └─┬ terser-webpack-plugin@1.4.5
│       └── webpack@4.46.0 deduped
├─┬ @storybook/angular@6.5.14
│ ├─┬ @storybook/core@6.5.14
│ │ ├─┬ @storybook/core-server@6.5.14
│ │ │ ├─┬ @storybook/builder-webpack4@6.5.14
│ │ │ │ ├─┬ css-loader@3.6.0
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ file-loader@6.2.0
│ │ │ │ │ └── webpack@5.75.0 deduped
│ │ │ │ ├─┬ html-webpack-plugin@4.5.2
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ postcss-loader@4.3.0
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ style-loader@1.3.0
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ terser-webpack-plugin@4.2.3
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ url-loader@4.1.1
│ │ │ │ │ └── webpack@5.75.0 deduped
│ │ │ │ ├─┬ webpack-dev-middleware@3.7.3
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ webpack-filter-warnings-plugin@1.2.1
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ └─┬ webpack@4.46.0
│ │ │ │   └─┬ terser-webpack-plugin@1.4.5
│ │ │ │     └── webpack@4.46.0 deduped
│ │ │ ├─┬ @storybook/manager-webpack4@6.5.14
│ │ │ │ ├─┬ css-loader@3.6.0
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ html-webpack-plugin@4.5.2
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ style-loader@1.3.0
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ terser-webpack-plugin@4.2.3
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ ├─┬ webpack-dev-middleware@3.7.3
│ │ │ │ │ └── webpack@4.46.0 deduped
│ │ │ │ └─┬ webpack@4.46.0
│ │ │ │   └─┬ terser-webpack-plugin@1.4.5
│ │ │ │     └── webpack@4.46.0 deduped
│ │ │ └─┬ webpack@4.46.0
│ │ │   └─┬ terser-webpack-plugin@1.4.5
│ │ │     └── webpack@4.46.0 deduped
│ │ └── webpack@5.75.0 deduped
│ ├─┬ postcss-loader@4.3.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ raw-loader@4.0.2
│ │ └── webpack@5.75.0 deduped
│ ├─┬ sass-loader@10.4.1
│ │ └── webpack@5.75.0 deduped
│ ├─┬ ts-loader@8.4.0
│ │ └── webpack@5.75.0 deduped
│ └── webpack@5.75.0 deduped
├─┬ @storybook/builder-webpack5@6.5.14
│ ├─┬ css-loader@5.2.7
│ │ └── webpack@5.75.0 deduped
│ ├─┬ fork-ts-checker-webpack-plugin@6.5.2
│ │ └── webpack@5.75.0 deduped
│ ├─┬ html-webpack-plugin@5.5.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ style-loader@2.0.0
│ │ └── webpack@5.75.0 deduped
│ ├─┬ terser-webpack-plugin@5.3.6
│ │ └── webpack@5.75.0 deduped
│ ├─┬ webpack-dev-middleware@4.3.0
│ │ └── webpack@5.75.0 deduped
│ └── webpack@5.75.0 deduped
├─┬ @storybook/manager-webpack5@6.5.14
│ ├─┬ @storybook/core-client@6.5.14
│ │ └── webpack@5.75.0 deduped
│ ├─┬ css-loader@5.2.7
│ │ └── webpack@5.75.0 deduped
│ ├─┬ webpack-dev-middleware@4.3.0
│ │ └── webpack@5.75.0 deduped
│ └── webpack@5.75.0 deduped
├─┬ ts-loader@9.4.2
│ └── webpack@5.75.0 deduped
└── webpack@5.75.0
b4lqfgs4

b4lqfgs41#

你必须一个接一个地更新。例如从Angular 9到10从10到11等等。回到版本12,然后尝试更新到13,然后到14。对于我这样工作,我有同样的错误,因为我试图直接升级版本9到13。
仁慈的伊戈尔·R

相关问题