--dev 选项在 Angular CLI 中不起作用
--dev option not working in Angular CLI
最近我升级到 Angular CLI 6.0.3
。我之前的构建脚本是
"build": "ng build --output-path ../public/ui"
,运行良好并生成文件
/ui/inline.bundle.js”.
/ui/polyfills.bundle.js”.
/ui/vendor.bundle.js”.
/ui/styles.bundle.js”.
/ui/main.bundle.js”
我注意到升级后生成的文件有不同的名称
main.js
polyfills.js
runtime.js
styles.js
vendor.js
我认为默认构建可能是 prod
所以我将脚本更改为
"build": "ng build --dev --output-path ../public/ui",
但我收到错误 Unknown option: '--dev'
我做错了什么?生成的文件名在v6中有变化吗?
是的,他们更改了生成包的名称。
Angular 客户端版本 1.7
node_modules/@angular/cli/models/webpack-configs/common.js
output: {
path: path.resolve(buildOptions.outputPath),
publicPath: buildOptions.deployUrl,
filename: `[name]${hashFormat.chunk}.bundle.js`,
chunkFilename: `[id]${hashFormat.chunk}.chunk.js`
}
Angular cli v6
node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js
output: {
path: path.resolve(root, buildOptions.outputPath),
publicPath: buildOptions.deployUrl,
filename: `[name]${hashFormat.chunk}.js`,
},
并且 dev 是使用 ng build
AFAIK
时的默认模式
最近我升级到 Angular CLI 6.0.3
。我之前的构建脚本是
"build": "ng build --output-path ../public/ui"
,运行良好并生成文件
/ui/inline.bundle.js”.
/ui/polyfills.bundle.js”.
/ui/vendor.bundle.js”.
/ui/styles.bundle.js”.
/ui/main.bundle.js”
我注意到升级后生成的文件有不同的名称
main.js
polyfills.js
runtime.js
styles.js
vendor.js
我认为默认构建可能是 prod
所以我将脚本更改为
"build": "ng build --dev --output-path ../public/ui",
但我收到错误 Unknown option: '--dev'
我做错了什么?生成的文件名在v6中有变化吗?
是的,他们更改了生成包的名称。
Angular 客户端版本 1.7
node_modules/@angular/cli/models/webpack-configs/common.js
output: {
path: path.resolve(buildOptions.outputPath),
publicPath: buildOptions.deployUrl,
filename: `[name]${hashFormat.chunk}.bundle.js`,
chunkFilename: `[id]${hashFormat.chunk}.chunk.js`
}
Angular cli v6
node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js
output: {
path: path.resolve(root, buildOptions.outputPath),
publicPath: buildOptions.deployUrl,
filename: `[name]${hashFormat.chunk}.js`,
},
并且 dev 是使用 ng build
AFAIK