Skip to content

Importing workspace projects in TS config files #6037

@stazz

Description

@stazz

Feature Use Case

When working in TS monorepos, they are implemented using npm/yarn/pnpm/etc workspaces.
There is typically more than one bundlable package, and often the Rollup configuration contains some commonly shared properties or organization-specific rules or guidelines.

These shared features of the config files are intuitive to expose via another workspace package, which is used as development dependency only during bundling.
However, importing such package in rollup.config.ts will cause errors, because the external check in cli/run/loadConfigFile.ts will think that any import which doesn't look like relative or absolute path is external.
As a result, the final CommonJS-transpiled configuration file will include the import statement, and will fail, since there is no JS code in the target package .

Feature Proposal

Because using relative or absolute path imports is not always feasible (think of package included via git submodule), it is important to have support for this usecase of complex monorepo setup.
The support should be conservatively implemented - that is, activated only via some configuration which is missing or not active by default.
The support should be agnostic to the TypeScript usage, and instead utilize some generic way to find out whether import which doesn't look like path should be marked as non-external after all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions