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
Rollup (using config from @open-wc/building-rollup) should be able to build projects that include dependencies using subpath exports, and more generally the exports field.
Actual Behavior
When a project attempts to import from a dependency that uses subpath exports:
if the subpath exactly matches the actual location in the repo (e.g. "./src/submodule.js": "./src/submodule.js"), it works fine
otherwise, the dependency is not found:
Error: 'example/file.js' is imported by src/index.js, but could not be resolved – treating it as an external dependency
This indicates the exports field in package.json is being ignored entirely.
Additional context
The solution is to upgrade @rollup/plugin-node-resolve to its latest version.
We are using @open-wc/building-rollup v1.10.0, but the issue is still present in v2. It's caused by using an old version of @rollup/plugin-node-resolve, which is set to ^7.1.1. We have resolved the issue on our end by explicitly adding the latest @rollup/plugin-node-resolve (v13.3.0) to our Rollup config, and setting nodeResolve: false in building-rollup.
Some discussion on Rollup's support of the exports field: rollup/plugins#208.
The text was updated successfully, but these errors were encountered:
Expected behavior
Rollup (using config from
@open-wc/building-rollup
) should be able to build projects that include dependencies using subpath exports, and more generally the exports field.Actual Behavior
When a project attempts to import from a dependency that uses subpath exports:
"./src/submodule.js": "./src/submodule.js"
), it works fineThis indicates the
exports
field inpackage.json
is being ignored entirely.Additional context
The solution is to upgrade
@rollup/plugin-node-resolve
to its latest version.We are using
@open-wc/building-rollup v1.10.0
, but the issue is still present in v2. It's caused by using an old version of@rollup/plugin-node-resolve
, which is set to^7.1.1
. We have resolved the issue on our end by explicitly adding the latest@rollup/plugin-node-resolve
(v13.3.0) to our Rollup config, and settingnodeResolve: false
in building-rollup.Some discussion on Rollup's support of the
exports
field: rollup/plugins#208.The text was updated successfully, but these errors were encountered: