0

I'm using angular-cli: 1.0.0-beta.28.3 to bundle the project files. When i run ng build, it creats main.bundle.js file under dist folder.

Instead of main.bundle.js I want to give a custom name (example: myproject.js). Is there a way to provide a custom output file name when using ng build.

1 Answer 1

4

Unfortunately no, the bundle names cannot be configurable. There is no option for such thing in the build wiki: https://github.com/angular/angular-cli/wiki/build

however, you can run a simple nodejs script to do that for you:

// rename.js file - location, right next to package.json
var fs = require("fs");
fs.rename("./dist/main.bundle.js", "./dist/myproject.js");

then in your package.json, add a new script call it something like build-rename

"scripts":{
   "build-rename":"ng build && node rename.js"
}

now run the script npm run build-rename

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.