From 4b63c9b1355001d2107e97026e0221f24ed4f6a6 Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Thu, 4 Jun 2020 13:07:57 +0200 Subject: [PATCH] Allow using the compiler as an ESM module --- rollup.config.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 6f3d893a33..82a2b9ae34 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -99,12 +99,20 @@ export default [ json(), ts_plugin ], - output: { - file: 'compiler.js', - format: is_publish ? 'umd' : 'cjs', - name: 'svelte', - sourcemap: true, - }, + output: [ + { + file: 'compiler.js', + format: is_publish ? 'umd' : 'cjs', + name: 'svelte', + sourcemap: true, + }, + { + file: 'compiler.mjs', + format: 'esm', + name: 'svelte', + sourcemap: true, + } + ], external: is_publish ? [] : id => id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree')