-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parcel v2 scope hoisting fails on one file #5770
Comments
Can you try using the |
Hi Niklas, I've been avoiding the nightly because of this:
... but I'll see if I can break the other stuff to test this one bit locally |
Hmm... Had a hack. Nightly appears to break all the absolute path stuff I have currently working on v1 and |
What exactly doesn't work anymore in the latest nightly? May or may not be a bug in itself |
@mischnic
Then in a file somewhere deep within foo/, a JS file will load something in If I make the entry points inside the subfolders, the absolute path convention doesn't quite work. So that's why the entries and their folders are in the same level. This works in the next version, but in the nightly gives me |
Update on the scope hoisting issue. One of our other build targets/dists fails at runtime with scope hoisting. This time with a |
Strange, both next and nightly resolve absolute paths from the project root (= the folder containing the lockfile or .git).
That might be related to this problem: #4634 (comment) |
I would git bisect it, or equivalent, but it seems to have the same issue with every nightly-xxx version I tried. I'm afraid I don't quite understand the release process and exactly how often |
There's a list of nightly versions on https://www.npmjs.com/package/parcel under versions.
|
Hi mate, thanks for that info. I've done a bit of manual bisecting and it appears the absolute path thing borks between 339 and 341
|
Is it rootDir vs entryRoot? https://diff.intrinsic.com/@parcel/core/2.0.0-nightly.339/2.0.0-nightly.341 It used to use the actual root of the directory, now it uses the root from the entry file? (thinking about it, root from entry file sounds like what it was already doing...) |
rootDir -> entryRoot was just a rename. Except for this here: So I guess I was wrong here and it wasn't already the case in the beta
|
Ah okay, thanks. What is the course of action with this then? Will nightly be adjusted to act as next currently does? Let me know if there's anything I can do to help! |
No, the nightly has the intended behaviour. https://v2.parceljs.org/features/module-resolution/ |
Ah, I see. I get that a lack of clarity with multiple entries means this technically does make sense, but it's a very confusing back and forth of paradigms between versions. Is there any way in which I can just force parcel to assume /src/ is the root, regardless of anything else, number of entries, etc? I could change my thousands of imports to, I presume, include the |
{
"dependencies": {
},
"alias": {
"shared": "./src/shared"
}
} import x from "shared/b.js";
console.log(x); |
-> https://www.npmjs.com/package/@mischnic/parcel-resolver-root |
@mischnic Oh wow, that's some high-speed plugin creation! Many thanks, I'll check it out |
hey @MaffooBristol, could you try checking out the |
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
This is a regression for Parcel v2, as it was fine in v1.
One file within my entire multi-build repo is failing to hoist.
There is nothing at all different about this file than any of the other many reselect selectors within the codebase. It is linked to by other files and is reachable by the entry point.
I've checked if it's a filename case-sensitivity issue but appears to not be.
Running with
--no-scope-hoist
fixes the issue, but it doesn't explain why it's happening.Build environment is basic browser based.
🎛 Configuration (.babelrc, package.json, cli command)
Fairly standard. Multi-dist mega-repo. Uses absolute paths (eg.
import foo from '/business/foo';
The only non-standard thing conf-wise is
parcel-namer-rewrite
and a transformer for"*.{svg,jpg,png,gif,pdf,woff,woff2,ttf,eot}": ["@parcel/transformer-raw"]
Uses a fair bit of lazy loading with Parcel's dynamic
import()
and React SuspenseFails on all tested node versions, so not that. Fails on Mac and Linux, local and CI.
🤔 Expected Behaviour
The source should build perfectly fine with default hoisting
😯 Current Behaviour
As above. It struggles on that one file and no others. No observable circular dependencies (and again, has worked fine before upgrading)
🌍 Your Environment
The text was updated successfully, but these errors were encountered: