Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Resolve all modules using Node resolution algorithm, but embed only specific ones #171

@slavafomin

Description

@slavafomin

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 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions