parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.39k stars 2.27k forks source link

Modules imported with incorrect capitalisation on case insensitve FS are not watched #1713

Open carlbennettnz opened 6 years ago

carlbennettnz commented 6 years ago

🐛 bug report

I'm using a case-insensitive file system (APFS on macOS) and I have imported a module using incorrect capitalisation in the file name (app.js when the actual file is App.js). The initial build works but subsequent changes to the module (App.js) do not trigger a reload.

Bug occurs for both script tags (shown below) and ES module imports.

🎛 Configuration (.babelrc, package.json, cli command)

$ parcel index.html

🤔 Expected Behavior

Either the initial build fails (bad import) or HMR is triggered on save.

😯 Current Behavior

The initial build succeeds but no reload is triggered on save.

💻 Code Sample

// App.js
console.log('hello world')
<!-- index.html -->
<script src="./app.js"></script> <!-- note incorrect capitalisation -->

🌍 Your Environment

Software Version(s)
Parcel 1.9.6
Node 8.9.4
Operating System macOS 10.13.5

image

devongovett commented 6 years ago

Dup of #1673 and #1674, which was closed as "Won't fix". You should fix your code to use the correct case. The reason we won't fix this is that if you tried to build your code on a case sensitive filesystem it will not work, making it non-portable.

carlbennettnz commented 6 years ago

Sorry, I did search for existing issues. Clearly not very well. 😕

Could/should parcel give an error when you use the wrong capitalisation? Would have saved me some time today.

devongovett commented 6 years ago

maybe... I want to avoid needing to check for case insensitivity on every file, but maybe we could offer a suggestion as part of the error message in case we cannot resolve a file?