3

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?

3
  • Yes they have changed the names. Commented May 24, 2018 at 9:45
  • Thanks. Happy to accept your answer if you'll like to convert you comment to an answer. Commented May 24, 2018 at 9:49
  • ng build uses dev by default. But you can change the build target like so: "build:stage": "ng build --configuration=stage". For more see angular.io/guide/workspace-config Commented Sep 25, 2021 at 16:03

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

So what is the solution.. ?
@Rafael Run ng build or run ng build --configuration=dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.