Stencil: Rollup: Unresolved Import

Created on 29 Jul 2020  路  5Comments  路  Source: ionic-team/stencil


Stencil version: 1.17.2

I'm submitting a:

[x] bug report
[ ] feature request
[ ] support request

Current behavior:
I was using v1.8.0 to build a design system, to import the design system in my stencil project I used

import 'my-design-system'

at my index.ts stencil project.

everything was fine.

So I updated to v1.17.2

now I have:

Rollup: Unresolved Import
Could not resolve './components' from ./node_modules/my-design-system/dist/collection/index.js

what happend? how can I solve this?

triage

Most helpful comment

When TypeScript 3.8 introduced import type https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html it also started to leave in the ./components import since it saw it as a "real" javascript import, rather than just a typescript type import. With the latest versions we also recommend:

export type { Components, JSX } from './components';

All 5 comments

in your index.ts file of the my-design-system component do the following:

replace the line

export * from './components';

with

export { Components, JSX } from './components';

I am having same issue. Thanks @glenveegee for your suggestion. It works now.

I have updated my index.ts in my-design-system to be :

export { Components, JSX } from './components';

When TypeScript 3.8 introduced import type https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html it also started to leave in the ./components import since it saw it as a "real" javascript import, rather than just a typescript type import. With the latest versions we also recommend:

export type { Components, JSX } from './components';

Thanks @glenveegee and @adamdbradley. In v2.0 that problem is solved also

I have this issue but only when building via bazel.

i really cannot tell why, but i've at least isolated the issue to being present starting with stencil 1.15.0. I was using 1.8.5 previously

building with just stencil (not invoked by bazel) works fine.

I keep getting a rollup error saying:

[ ERROR ]  Rollup: Unresolved Import
           Could not resolve './my-compenent.stylus?tag=my-compenent' from
           ./src/components/my-compenent/my-compenent.tsx

any ideas?

Was this page helpful?
0 / 5 - 0 ratings