Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build error after updating Svelte: Package subpath './compiler.js' is not defined by "exports"

Problem

I was on Svelte version 3.0.0 and used npm i svelte@latest to update to the most recent version. Now I can't get the app to run, I always get this errror:

[!] Error: Package subpath './compiler.js' is not defined by "exports" in /home/blub/coding/bla/node_modules/svelte/package.json Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './compiler.js' is not defined by "exports" in /home/blub/coding/bla/node_modules/svelte/package.json

Failed Solutions

I also updated rollup-plugin-svelte to version 5.2.0, but that did not help. Are there any other dependencies I also have to update? Here is a list of my dependencies:

  "devDependencies": {
    "node-sass": "^4.12.0",
    "npm-run-all": "^4.1.5",
    "rollup": "^2.44.0",
    "rollup-plugin-commonjs": "^10.0.0",
    "rollup-plugin-livereload": "^1.0.0",
    "rollup-plugin-node-resolve": "^5.2.0",
    "rollup-plugin-svelte": "^5.2.3",
    "rollup-plugin-terser": "^4.0.4",
    "svelte": "^3.37.0",
    "svelte-preprocess-sass": "^0.2.0"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "sirv-cli": "^0.4.4"
  },
like image 378
Gh05d Avatar asked Apr 06 '21 09:04

Gh05d


1 Answers

This issue is due to a breaking change of svelte v3.29.5. So if you want to use this version you will also need to update rollup-plugin-svelte to at least v6.1.1:

npm i -D [email protected]
# or with yarn
yarn add -D [email protected]
like image 196
johannchopin Avatar answered Oct 05 '22 11:10

johannchopin