Closed mccahan closed 7 months ago
I'm not able to access the repro link, is this still an issue for you ? I'd be happy to take a look if yes.
Whoop, sorry @AGawrys, repo is public now!
I have similar problem but with a much bigger mono repo. Have tons of those "cannot find module", only in production build. Failed to make a repro repo yet though.
Still broken with the new bundler:
diff --git package.json package.json
index 3ad483e..6941f3a 100644
--- package.json
+++ package.json
@@ -3,6 +3,7 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
- "parcel": "^2.6.2"
+ "gsap": "^3.11.4",
+ "parcel": "2.8.3"
}
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.
🐛 bug report
When using two linked HTML files with two JS files that utilize the same includes, if the order of the
<script>
tags in the HTML is not the same, you get a "Cannot find module" console error, e.g.:I put together a minimal reproducible test case here: https://github.com/mccahan/parcel-order-bug-demo . In that demo: indexa.html includes a.js, then b.js and functions correctly indexb.html includes b.js, then a.js and throws an error
Both JS files import the same library (using GSAP here but I don't think it matters), but are otherwise completely independent of one another.
If I change the HTML files to have the same order (either a,b or b, a, it doesn't matter) the error goes away and everything functions as intended.
🎛 Configuration (.babelrc, package.json, cli command)
See my reproducible test case here: https://github.com/mccahan/parcel-order-bug-demo
package.json:
🤔 Expected Behavior
The order of these independent JS files shouldn't matter; they include the same external library but they don't interfere with each other at all.
😯 Current Behavior
The second processed HTML file (in my reproducible test case,
indexb.html
, shows a Cannot find module error:💁 Possible Solution
🔦 Context
We have a website where we use GSAP in multiple scripts on multiple pages, with one common shared script and then independent scripts for each page to add additional page-specific functionality. We were hitting this error message on one page that happened to have the main.js file after the the page-specific scripts for that page instead of the first script on the page, so it was failing.
The error message was pretty useless and I couldn't find anything in the manual about it, so it was really a matter of trial-and-error to figure out what the issue was. Ideally it either handles this situation correctly, or has some kind of useful error message to indicate what's happening
💻 Code Sample
🌍 Your Environment
Thank you!