Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

--dev option not working in Angular CLI

Recently I upgraded to Angular CLI 6.0.3. My previous build script was

"build": "ng build --output-path ../public/ui", which worked fine and generated files

/ui/inline.bundle.js”. /ui/polyfills.bundle.js”. /ui/vendor.bundle.js”. /ui/styles.bundle.js”. /ui/main.bundle.js”

I notice that after upgrade, the files been generated have different names

main.js polyfills.js runtime.js styles.js vendor.js

I thought that maybe the default build is prod so I changed my script to "build": "ng build --dev --output-path ../public/ui",

but I get error Unknown option: '--dev'

What am I doing wrong? Have the generated file name changed in v6?

like image 399
Manu Chadha Avatar asked Feb 07 '26 02:02

Manu Chadha


1 Answers

Yes they have changed the names of the generated bundles.

Angular cli v 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`,
    },

And dev is the default mode when using ng build AFAIK

like image 118
David Avatar answered Feb 08 '26 22:02

David



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!