question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build silently failing (ERR_PACKAGE_PATH_NOT_EXPORTED)

See original GitHub issue

🐛 Bug Report

The bug specifically is in https://github.com/sveltejs/svelte/issues/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
}

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jojonascommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports ...
Read more >
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'
Run the npm update command to solve the "Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'" and then run npm audit fix --force if necessary.
Read more >
parcel-plugin-svelte - Bountysource
Parser "parcel-plugin-svelte\lib\svelte-asset.js" failed to initialize when ... Threw the following error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package ...
Read more >
Error at phase of Compiling assets when deploy with edeliver
Compiling assets A remote command failed on: deploy@x.x.x.x ... js/app.js Module build failed: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No ...
Read more >
Configuring Jest
If included in the list, the built-in GitHub Actions Reporter will annotate changed files with test failure messages: JavaScript; TypeScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found