简体   繁体   中英

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

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

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"
  },

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 .

I had an old Svelte project and did not have time to update it all. I found downgrading Svelte to 3.29.4 fixed the issue.

npm i -D svelte@3.29.4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM