Build silently failing (ERR_PACKAGE_PATH_NOT_EXPORTED)
Opened this issue ยท 5 comments
๐ 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
}
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.
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!
@loristewis See this commit: bd8207c and #153
is this plugin completely broken? since there are no updates for nearly a year ?
@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...