-
-
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
Flag for scope-hoisting in serve/watch mode #5280
Comments
In development mode, "main" is used because it has to be transpired to commonjs anyway. |
just tested and looks like I had to walk through the core and found this piece of default-resolver: // If scope hoisting is enabled, we can get smaller builds using esmodule input, so choose `module` over `main`.
// Otherwise, we'd be wasting time transforming esmodules to commonjs, so choose `main` over `module`.
if (dependency.env.scopeHoist) {
mainFields.push('module', 'main');
} else {
mainFields.push('main', 'module');
} that means that |
ok, the issue comes from disabled |
Does the comment in the code snippet you posted still not answer your question? Related issue: #4879 |
@mischnic it answers about scope hoisting in general and its performance, but not why scope hosting (for es 'module') is disabled by default for watch/serve and there is no option to enable it |
Ah, two reasons:
|
@mischnic ok, thanks! Anyway, it would be nice to have more transparency and control over scope hoisting, something opposite param to |
Isn't this a bug in the package that there is a "main" field pointing to a non-existent file? |
@devongovett it's a main problem for sure, but it has raised what we just discussed here - Anyway, changing it to |
🐛 bug report
I'm trying to import node package into my app, package has 'main' and 'module' props in it's package.json:
as result with parcel@v1 it works ok - package is imported as module,
but using parcel@next or parcel@nightly gives me following error:
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
The text was updated successfully, but these errors were encountered: