Open cmditch opened 3 years ago
Looks like it's being caused by this dynamic import in the Stencil code.
In the @stencil/core
package, that has been compiled to something like:
!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && 8 & o.$flags$ && (n = await import("./shadow-css.js").then((e => e.scopeCss(n, l, !1)))),
I think this is the same root cause as #3094. Looks like esbuild doesn't natively support dynamic imports yet, so Snowpack would have to work around this but doesn't quite do it right atm. Though it's possible I've missed something and this is actually coming from Rollup - not 100% sure.
It appears that the Stencil team is also aware of this issue.
Bug Report Quick Checklist
Describe the bug
Snowpack does not seem to play nice with
@stencil/core
Seeing the error below whenimport stencil from '@stencil/core/internal/client'
exists within code. This is a necessary import for Stencil custom elements.Error:
[16:19:08] [snowpack] Cannot find module ''../../../common/shadow-css-bb8fe40a.js'' from '/Users/cmditch/sandbox/snowpack-stencil/node_modules/@stencil/core/internal/client/index.js'
To Reproduce
Expected behavior
A build w/o errors.
Anything else?
When I load a stencil component via a
<script>
tag over the wire it works, but if I try to build it using snowpack it does not work. Stencil docs have an example of how to bundle a component w/ rollup here, so it seems like Stencil and rollup can play nice. Perhaps it's the way snowpack is configuring rollup.Lastly, oddly enough the file/path
../../../common/shadow-css-bb8fe40a.js
does not even exist withinnode_modules/@stencil/core
. It's also not clear where this filename is being generated within their source.