esinstall can't import Svelte component libraries with JS entry point #1808
Replies: 5 comments 6 replies
-
esinstall uses Rollup internally, so you can add Rollup plugins to customize esinstall's package install process.
|
Beta Was this translation helpful? Give feedback.
-
I was seeing the same performance issue today importing the Using snowpack 2.17.1, which includes esinstall 0.3.7, I am able to import from the package, but with 2.18 I see the same behavior that Rich encountered, where esinstall uses a lot of CPU and eats up all the heap until it OOMs. |
Beta Was this translation helpful? Give feedback.
-
I've just tried this importing
This also happens with snowpack 2.18, and FWIW, 2.16 |
Beta Was this translation helpful? Give feedback.
-
This still appears to be an issue with ‘barrel’ imports, which is how many component libraries are packaged. @FredKSchott @Rich-Harris thoughts? |
Beta Was this translation helpful? Give feedback.
-
Update (/cc @fabien @Rich-Harris) Confirmed repro is fixed in #2707 |
Beta Was this translation helpful? Give feedback.
-
Repro here: https://github.com/Rich-Harris/esinstall-repro
If a project imports a Svelte component from npm, where the
"svelte"
field in package.json points to an individual component, esinstall copies the component across untouched.But if
"svelte"
points to a JS module (which is totally valid — the module in turn imports Svelte components), esinstall will attempt to install it.In the best case scenario, this results in a compiled component in
web_modules
, but because it bundlessvelte/internal
, it will fail in many apps (sincesvelte/internal
essentially needs to be a singleton — it's no good to have first-party and third-party components controlled by separate schedulers). It also fails in SSR, because it is compiled as a CSR component by default.In the worst case scenario, esinstall hangs for a while before the process runs out of memory and crashes. I haven't been able to figure out why this happens, but I know when it happens — components with
<style>
(which result in a .css import being added) cause this behaviour. This is the case for @sveltejs/pancake, for example.Ideally, .svelte files and other non-JS assets would be excluded from the installation process, for later processing by Snowpack. Is that possible?
Beta Was this translation helpful? Give feedback.
All reactions