Incompatibility with Node.js 14 ESM exports.
kriskowal opened this issue ยท 1 comments
kriskowal commented
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch rollup-plugin-svelte@5.2.3 for the project I'm working on.
The problem is that svelte has an exports map in its package.json that expresses that svelte/compiler corresponds to svelte/compiler.mjs and does not also provide a svelte/compiler.js mapping. rollup-plugin-svelte takes a dependency on the latter, depending on the Node.js version.
Here is the diff that solved my problem:
diff --git a/node_modules/rollup-plugin-svelte/index.js b/node_modules/rollup-plugin-svelte/index.js
index 0d52cfb..07bbeea 100644
--- a/node_modules/rollup-plugin-svelte/index.js
+++ b/node_modules/rollup-plugin-svelte/index.js
@@ -8,7 +8,7 @@ const { encode, decode } = require('sourcemap-codec');
const major_version = +version[0];
const { compile, preprocess } = major_version >= 3
- ? require('svelte/compiler.js')
+ ? require('svelte/compiler')
: require('svelte');
function sanitize(input) {This issue body was partially generated by patch-package.