Jake
Jake

Reputation: 379

Changing output directory for angular cli files

I'm trying to serve inline.bundle.js, main.bundle.js, polyfills.bundle.js, styles.bundle.css, and vendor.bundle.js from /assets rather then the root of the dist folder. I can change the url requested in index.html by adding "deployUrl": "/assets", to my .angular-cli.json file, but the files are still output to the root of the dist folder.

How can I change the output folder of those files to be output into /assets?

Upvotes: 2

Views: 1541

Answers (3)

sancelot
sancelot

Reputation: 2053

try modifiying webpack config as follow

 output: {
    path: __dirname,   
    filename: 'assets/bundle.js', // move the bundle.js file under the assets folder
 }

for your css, if you are using extractTextPlugin, you can specify css output :

new ExtractTextPlugin('./assets/bundle.css'), // bundle.css will be put under /dist/css/

Upvotes: -1

Jake
Jake

Reputation: 379

I ended up just adding a mv dist/*.bundle.js* dist/assets to build in my package.json. And mv dist/*.bundle.css* dist/assets && mv dist/*.bundle.js* dist/asse for prod.

Upvotes: 1

DeborahK
DeborahK

Reputation: 60518

Have you tried setting the "outDir"?

  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      ...

Upvotes: 1

Related Questions