Angular 6: 找不到模块 '@angular/cli/plugins/webpack'
Angular 6: Cannot find module '@angular/cli/plugins/webpack'
我已按照 update guide 中提到的所有步骤将我的项目从 Angular 5.2 更新到 Angular 6.0。
现在,当 运行 npm start 时,出现以下错误:
Error: Cannot find module '@angular/cli/plugins/webpack'
抛出错误的行是 webpack.config.js
中的导入
const { GlobCopyWebpackPlugin } = require('@angular/cli/plugins/webpack');
plugins.push(new GlobCopyWebpackPlugin({
"patterns": [
"assets",
"favicon.ico"
],
"globOptions": {
"cwd": process.cwd() + "/src",
"dot": true,
"ignore": "**/.gitkeep"
}
}));
CLI 1.6 中不再存在导入的包。
也在找,没找到解决方案(更新webpack配置或者用其他东西替换GlobCopyWebpackPlugin)。
我使用 CopyWebpackPlugin 代替
寻求此解决方案
const CopyWebpackPlugin = require('copy-webpack-plugin');
plugins.push(new CopyWebpackPlugin([
{ from: process.cwd() + '/src/assets/**/*', to: process.cwd() + "/dist", ignore: ['*.gitkeep'] },
{ from: process.cwd() + '/src/favicon.ico', to: process.cwd() + "/dist" }
]));
我已按照 update guide 中提到的所有步骤将我的项目从 Angular 5.2 更新到 Angular 6.0。 现在,当 运行 npm start 时,出现以下错误:
Error: Cannot find module '@angular/cli/plugins/webpack'
抛出错误的行是 webpack.config.js
中的导入const { GlobCopyWebpackPlugin } = require('@angular/cli/plugins/webpack');
plugins.push(new GlobCopyWebpackPlugin({
"patterns": [
"assets",
"favicon.ico"
],
"globOptions": {
"cwd": process.cwd() + "/src",
"dot": true,
"ignore": "**/.gitkeep"
}
}));
CLI 1.6 中不再存在导入的包。
也在找,没找到解决方案(更新webpack配置或者用其他东西替换GlobCopyWebpackPlugin)。
我使用 CopyWebpackPlugin 代替
寻求此解决方案const CopyWebpackPlugin = require('copy-webpack-plugin');
plugins.push(new CopyWebpackPlugin([
{ from: process.cwd() + '/src/assets/**/*', to: process.cwd() + "/dist", ignore: ['*.gitkeep'] },
{ from: process.cwd() + '/src/favicon.ico', to: process.cwd() + "/dist" }
]));