Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

External deps resolution fails #100

Closed
codechips opened this issue Jan 9, 2020 · 1 comment
Closed

External deps resolution fails #100

codechips opened this issue Jan 9, 2020 · 1 comment

Comments

@codechips
Copy link

馃悰 Bug Report

Seems like Parcel does not bundle Svelte internals correctly for external packages that rely on them. Everything builds correctly, but then I get a clientside error:

Uncaught TypeError: store.subscribe is not a function
    at Object.subscribe (index.mjs:41)
    at V (yrv.min.js:1)
    at Object.init (index.mjs:1350)
    at new W (yrv.min.js:1)
    at create_fragment (App.svelte:236)
    at init (index.mjs:1364)
    at new App (App.svelte:300)
    at Object.parcelRequire.main.js../App.svelte (main.js:3)
    at newRequire (main.1f19ae8e.js:47)
    at main.1f19ae8e.js:81

External package in question: https://github.com/pateketrueke/yrv

I think it's a Parcel error because it works fine with Rollup. Per default Parcel grabs pkg.browser entry and if that doesn't exist it grabs pkg.module. Both of them give the same error. However, in external package there is also pkg.svelte that points to the raw source. When pointing to that entry (removing pkg.browser and manually pointing pkg.module to src/index.js directly in node_modules dir) everything works.

From what I saw in Svelte plugin code pkg.svelte is used for compiler options. I am also not aware of any bundler that uses pkg.svelte entry point during package resolution and I don't know what is considered a standard, so TBH I am not sure why the author put it there in the first place and what purpose it serves.

馃帥 Configuration (.svelterc, package.json, cli command)

Available in code sample.

To reproduce run the command below and check the browser's dev console:

yarn parcel serve src/index.html --port 3000 --log-level 4 --no-cache

馃捇 Code Sample

https://github.com/iljoo/svelte-parcel-yrv-bug

馃實 Your Environment

Yarn, plus latest and greatest Parcel and Svelte.

@codechips
Copy link
Author

Closing as this seems to be resolved somehow somewhere in the dependency chain 馃檭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants