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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build silently failing (ERR_PACKAGE_PATH_NOT_EXPORTED) #152

Open
fregante opened this issue Nov 10, 2020 · 5 comments
Open

Build silently failing (ERR_PACKAGE_PATH_NOT_EXPORTED) #152

fregante opened this issue Nov 10, 2020 · 5 comments

Comments

@fregante
Copy link

fregante commented Nov 10, 2020

🐛 Bug Report

The bug specifically is in sveltejs/svelte#5659, which is strictly not due to this plugin, but parcel build failed without changing the exit code, so this caused my CI to deploy a broken built file.

I don't know if this is a problem with Parcel not setting the exit code or this plugin reporting it as a warning.

🎛 Configuration (.svelterc, package.json, cli command)

parcel build --public-url ./ demo/index.html

⚠️  Parser "parcel-plugin-svelte/lib/svelte-asset.js" failed to initialize when processing asset "demo/App.svelte". Threw the following error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './compiler.js' is not defined by "exports" in /home/runner/work/github-url-detection/github-url-detection/node_modules/svelte/package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
    at resolveExports (internal/modules/cjs/loader.js:432:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (/home/runner/work/github-url-detection/github-url-detection/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/runner/work/github-url-detection/github-url-detection/node_modules/parcel-plugin-svelte/lib/svelte-asset.js:2:33)
    at Module._compile (/home/runner/work/github-url-detection/github-url-detection/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) falling back to RawAsset
⚠️  Parser "parcel-plugin-svelte/lib/svelte-asset.js" failed to initialize when processing asset "demo/App.svelte". Threw the following error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './compiler.js' is not defined by "exports" in /home/runner/work/github-url-detection/github-url-detection/node_modules/svelte/package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
    at resolveExports (internal/modules/cjs/loader.js:432:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (/home/runner/work/github-url-detection/github-url-detection/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/runner/work/github-url-detection/github-url-detection/node_modules/parcel-plugin-svelte/lib/svelte-asset.js:2:33)
    at Module._compile (/home/runner/work/github-url-detection/github-url-detection/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) falling back to RawAsset
✨  Built in 1.98s.

dist/App.0a75e0c7.svelte        1.93 KB    509ms
dist/main.127a4158.js           1.47 KB    772ms
dist/global.8961bae3.css.map      847 B      4ms
dist/index.html                   714 B    1.09s
dist/main.127a4158.js.map         554 B      1ms
dist/global.8961bae3.css          388 B    778ms

💻 Code Sample

Every build is affected, but in my case the issue was on https://github.com/fregante/github-url-detection (but was avoided by forcing an older version of Svelte)

🌍 Your Environment

Node 14.4.0

{
	"parcel-bundler": "^1.12.4",
	"parcel-plugin-svelte": "^4.0.6",
	"svelte": "3.29.6" // This version is broken
}
@jojonas
Copy link

jojonas commented Nov 10, 2020

Changing the imports to const { compile, preprocess } = require('svelte/compiler'); appears to resolve the issue. However, I don't know if the import will work for older Svelte versions too.

@loristewis
Copy link

Hey there,
I'm having the same issue with my project.
@jojonas could you expand on how to fix this? Where should I add const { compile, preprocess } = require('svelte/compiler');?
Thanks!

@jojonas
Copy link

jojonas commented Nov 25, 2020

@loristewis See this commit: bd8207c and #153

@ta3pks
Copy link

ta3pks commented Jun 7, 2021

is this plugin completely broken? since there are no updates for nearly a year ?

@DeMoorJasper
Copy link
Owner

@NikosEfthias there hasn't been any new issues reported so there's no new releases...

There's also a Parcel 2 plugin now, so this plugin will probably get deprecated once Parcel 2 reaches stable...

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

No branches or pull requests

5 participants