Flag for scope-hoisting in serve/watch mode
See original GitHub issue🐛 bug report
I’m trying to import node package into my app, package has ‘main’ and ‘module’ props in it’s package.json:
"main": "dist/index.js",
"module": "src/index.js",
as result with parcel@v1 it works ok - package is imported as module, but using parcel@next or parcel@nightly gives me following error:
@parcel/resolver-default:
"main": "dist/index.js",
> | ^^^^^^^^^^^^^^^^^^^^^ './dist/index.js' does not existundefined'
even though dist/index.js doesn’t exist, why it’s loaded instead of ‘module’ source?
🎛 Configuration (.babelrc, package.json, cli command)
no config
🤔 Expected Behavior
importing package as module
😯 Current Behavior
importing package main dist
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Scope hoisting - Parcel
In production builds, Parcel concatenates modules into a single scope. This is called "scope hoisting". Parcel also statically analyzes the imports and ...
Read more >Understanding Hoisting in Javascript | by Swati Sucharita
Hoisting means moving something up like with a rope like flag ... Javascript moves the variable declaration to the top of the scope....
Read more >JavaScript Hoisting - W3Schools
Hoisting is JavaScript's default behavior of moving declarations to the top. ... current scope (to the top of the current script or the...
Read more >JavaScript Hoisting - GeeksforGeeks
In JavaScript, Hoisting is the default behavior of moving all the declarations at the top of the scope before code execution.
Read more >Understanding Hoisting in JavaScript - DigitalOcean
As we've seen above, variables within a global scope are hoisted to the top ... By enabling strict mode, we opt into a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mischnic ok, thanks! Anyway, it would be nice to have more transparency and control over scope hoisting, something opposite param to
--no-scope-hoist, like--with-scope-hoist(default for build, and optional for watch/serve)Ah, two reasons: