brandonroberts / angular-router-loader

A Webpack loader that enables string-based module loading with the Angular Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Production build names vs dev build names

aaronfrost opened this issue · comments

When I use this loader in dev mode, it outputs a second file for my lazy bundle called dist1.bundle.js. However, when I run webpack to build it for production, the second file is called 1.bundle.js. So... I can't run the minified/built code, cause it is looking for dist1.bundle.js, but that file doesn't exist.

This is webpack1. Any ideas? How do I get the dev file and and production file name to match?

Using named chunks gives you control over what the filename of the produced chunk will be. I would also check the output section of your webpack config for the filename format.

    output: {
      filename: '[name].[chunkhash].bundle.js',
      sourceMapFilename: '[name].[chunkhash].bundle.map',
      chunkFilename: '[id].[chunkhash].chunk.js'
    },

@brandonroberts thanks for responding, and for doing it so quickly as well.

So... I had been buggering around with the name and hash aliases, but had no success. I added your stuff, and I am in the same scenario. Now i have in dev dist1.<hash>.bundle.ts and in prod I have `1..bundle.js'. So... it is optionally adding that 'dist' in there. I feel like this is an error with our webpack setup. Any ideas?

You are a gentleman. I think I figured it out. I will let you know if I need anymore help, but for now, you have clearly gone above and beyond, supporting me in my unrelated issue.

Thanks @brandonroberts!

Glad you got it worked out! 👍