2

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?

3 Answers 3

1

Have you tried setting the "outDir"?

  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      ...
Sign up to request clarification or add additional context in comments.

2 Comments

I tried this but it sets the output directory for ALL files. So index.html, favicon.ico and even my assets folder end up in dist/assets. (so all my assets are in dist/assets/assets)
I see. I don't think that there is a way to separate different parts of the output into different folders. You may want to post an issue/question to the github repo for the CLI.
1

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.

1 Comment

How does angular know where those files were moved to?
-1

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/

Comments

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.