aspirisen
aspirisen

Reputation: 1025

Webpack makes invalid bundle when change the module's name case

it may sounds strange, but when I change the module name in my application, webpack changes the bundle output and makes it wrong. I have windows, it means that module paths should be case insensitive and the bundles must be the same all the time. Webpack shows me that some modules have ambiguous names and it can affect if you are using case-sensitive OS, but nevertheless the bundle works correct.

Then I fixed by changing the names in require from lower-case component to uppercase Component and after that webpack begins making invalid bundle, and there are a lot of diffs if you compare these two output bundles. My questions are: why does webpack behave different with case-sensitive names in case-insensitive environment and how to fix it? Maybe it changes the modules order or something like this. P.S. The app is big: ~2.5 mb. P.S.S. The problem is in inheritance. I use TypeScript and the error is that I try to extend from undefined.

Thanks!

Upvotes: 1

Views: 655

Answers (1)

basarat
basarat

Reputation: 275967

why does webpack behaves different with case-sensitive name in case-insensitive environment

The true enviroment for webpack is the web and the web is case sensitive. Also it's probably just ordering e.g. alphabetically and that will change the ordering with changing names.

The problem is in inheritance. I use TypeScript and the error is that I try to extend from undefined

You might have a circular reference in there. The fact that it worked before is conincidental (e.g. the ordering by file names satisfied what was expected).

Fix

Remove the circular reference. E.g. use atom-typescript to find it : https://github.com/TypeStrong/atom-typescript/blob/master/docs/dependency-view.md#circular

Upvotes: 3

Related Questions