From 500b107564ffad4303c324a7e9eda884efb7d77e Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 20 Jul 2023 09:49:40 -0700 Subject: [PATCH] convert Svelte example project to ESM --- e2e/svelte/package.json | 8 ++++++-- e2e/svelte/svelte.config.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/e2e/svelte/package.json b/e2e/svelte/package.json index 5ffec91..b0e592e 100644 --- a/e2e/svelte/package.json +++ b/e2e/svelte/package.json @@ -2,11 +2,12 @@ "name": "svelte-app", "version": "1.0.0", "private": true, + "type": "module", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", "start": "sirv public --no-clear", - "test": "jest src", + "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest src", "test:watch": "npm run test -- --watch" }, "devDependencies": { @@ -32,12 +33,15 @@ "transform": { "^.+\\.js$": "babel-jest", "^.+\\.svelte$": [ - "../../dist/transformer.cjs", + "../../dist/transformer.mjs", { "preprocess": true } ] }, + "extensionsToTreatAsEsm": [ + ".svelte" + ], "moduleFileExtensions": [ "js", "svelte" diff --git a/e2e/svelte/svelte.config.js b/e2e/svelte/svelte.config.js index 65287ca..61fdb3f 100644 --- a/e2e/svelte/svelte.config.js +++ b/e2e/svelte/svelte.config.js @@ -1,5 +1,5 @@ -const sveltePreprocess = require('svelte-preprocess') +import sveltePreprocess from 'svelte-preprocess'; -module.exports = { +export default { preprocess: sveltePreprocess({ sourceMap: true }) }