From cd95654a970046e6bd03a7081dfd5f27ec0d4abc Mon Sep 17 00:00:00 2001 From: Alex Rock Date: Fri, 14 Aug 2020 05:36:55 +0200 Subject: [PATCH] Allow using the compiler as an ESM module (#4972) --- 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')