You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
import {foo} from './foo';, which should be resolved to: import {foo} from './foo/index.js'; according to the Node resolution algorithm.
But, at the same time, I have some modules in node_modules, which I want to embed to my bundle and the ones I want to leave as external.
However, if I set the only option to something like: only: ['tslib'], the Rollup stops resolving my local imports like import {foo} from './foo';. And if I omit the only option, the modules are resolved correctly, but it embeds everything it could find to the final bundle (which I don't want to do).
Is there a way to use node resolution algorithm for all imports, but to embed only specific modules to the bundle?
I think these are two separate processes (module resolution and module embedding), and one option shouldn't prevent another from working.
It's OK (and desired) to embed all imports to a bundle, when you build a final application, however, when it comes to library building you need a more granular control of what to actually embed and what to leave as external dependency.
The only workaround I can think of so far is to run Rollup two times: one to resolve all local dependencies and leave everything from node_modules as external and then to embed some external dependencies to the bundle. But I would really want to avoid such approach.
Could you elaborate on this issue please? Thanks!
The text was updated successfully, but these errors were encountered:
slavafomin
changed the title
Resolve modules using Node resolution algorithm, but embed only specific ones
Resolve all modules using Node resolution algorithm, but embed only specific ones
Jul 19, 2018
Hello!
Thank you for this great plugin!
I'm using the following imports in my project:
import {foo} from './foo';
, which should be resolved to:import {foo} from './foo/index.js';
according to the Node resolution algorithm.But, at the same time, I have some modules in
node_modules
, which I want to embed to my bundle and the ones I want to leave as external.However, if I set the
only
option to something like:only: ['tslib']
, the Rollup stops resolving my local imports likeimport {foo} from './foo';
. And if I omit theonly
option, the modules are resolved correctly, but it embeds everything it could find to the final bundle (which I don't want to do).Is there a way to use node resolution algorithm for all imports, but to embed only specific modules to the bundle?
I think these are two separate processes (module resolution and module embedding), and one option shouldn't prevent another from working.
It's OK (and desired) to embed all imports to a bundle, when you build a final application, however, when it comes to library building you need a more granular control of what to actually embed and what to leave as external dependency.
The only workaround I can think of so far is to run Rollup two times: one to resolve all local dependencies and leave everything from
node_modules
as external and then to embed some external dependencies to the bundle. But I would really want to avoid such approach.Could you elaborate on this issue please? Thanks!
The text was updated successfully, but these errors were encountered: