简体   繁体   中英

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. PS The app is big: ~2.5 mb. PSS The problem is in inheritance. I use TypeScript and the error is that I try to extend from undefined.

Thanks!

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 eg 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 (eg the ordering by file names satisfied what was expected).

Fix

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM