0

Recently I switched to webpack from angular cli because I was facing issue with some libraries. I manually included few scripts within webpack.config.js file. So, now how can I compile the angular project without switching back to cli?

Previously I used this command to compile the angular project: ng build -prod --aot=false

Is there any equivalent options within webpack?

Rahul Dagli
  • 4,301
  • 15
  • 47
  • 85
  • See this:https://angular.io/guide/webpack#production-configuration – Vikas Mar 12 '18 at 14:09
  • See this answer: https://stackoverflow.com/questions/44861191/how-to-work-with-ngcli-after-ejecting-the-webpack-config/44861648#44861648 – R. Richards Mar 12 '18 at 15:42
  • Possible duplicate of [How to work with ngcli after ejecting the webpack config?](https://stackoverflow.com/questions/44861191/how-to-work-with-ngcli-after-ejecting-the-webpack-config) – Louis Jul 30 '18 at 17:06

1 Answers1

-1

Why not use yarn

yarn build

Yarn is an alternative package manager for NPM packages with a focus on reliability and speed.

To enable Yarn for Angular CLI you have to run the following command:

ng set --global packageManager=yarn

More info can be find over here

Jimq
  • 362
  • 4
  • 17
  • Thanks, how do I define `--base-href` path in yarn? since I'm not uploading project in the root directory so I'm getting 404 error for missing dependencies. – Rahul Dagli Mar 12 '18 at 14:59
  • In your webpack.config.js, under module.exports look for "output" there you will find a path property which you can change as per you need. ex: "output": { "path": "/Users/jim/Desktop/dist", "filename": "[name].[chunkhash:20].bundle.js", "chunkFilename": "[id].[chunkhash:20].chunk.js" } – Jimq Mar 12 '18 at 15:29