diff --git a/.gitignore b/.gitignore index 930c8dc863..dbed468f15 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,10 @@ node_modules *.map /cli/ -/compiler/ -/ssr/ -/internal.js /compiler.js +/index.js +/internal.* +/store.js /scratch/ /coverage/ /coverage.lcov/ @@ -15,7 +15,6 @@ node_modules /test/sourcemaps/samples/*/output.js.map /test/sourcemaps/samples/*/output.css /test/sourcemaps/samples/*/output.css.map -/store.umd.js /yarn-error.log _actual*.* -_*/ \ No newline at end of file +_*/ diff --git a/index.js b/index.mjs similarity index 77% rename from index.js rename to index.mjs index 9fdeadb8fa..44031c35c8 100644 --- a/index.js +++ b/index.mjs @@ -4,4 +4,4 @@ export { beforeUpdate, afterUpdate, createEventDispatcher -} from './internal.js'; +} from './internal'; diff --git a/package.json b/package.json index 4844644834..f12c429aa9 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "svelte", "version": "3.0.0-alpha6", "description": "The magical disappearing UI framework", + "module": "index.mjs", "main": "index.js", "bin": { "svelte": "svelte" @@ -10,9 +11,9 @@ "cli", "compiler.js", "register.js", - "index.js", - "internal.js", - "store.js", + "index.*", + "internal.*", + "store.*", "svelte", "README.md" ], diff --git a/rollup.config.js b/rollup.config.js index 3229a2800f..1bb01c9282 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,14 +1,12 @@ -import path from 'path'; import replace from 'rollup-plugin-replace'; import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; import json from 'rollup-plugin-json'; import typescript from 'rollup-plugin-typescript'; -import buble from 'rollup-plugin-buble'; import pkg from './package.json'; export default [ - /* compiler/svelte.js */ + /* compiler.js */ { input: 'src/index.ts', plugins: [ @@ -54,12 +52,38 @@ export default [ experimentalCodeSplitting: true }, - /* internal.js */ + /* index.js */ + { + input: 'index.mjs', + output: { + file: 'index.js', + format: 'cjs' + }, + external: name => name !== 'index.mjs' + }, + + /* internal.[m]js */ { input: 'src/internal/index.js', + output: [ + { + file: 'internal.mjs', + format: 'esm' + }, + { + file: 'internal.js', + format: 'cjs' + } + ] + }, + + /* store.js */ + { + input: 'store.mjs', output: { - file: 'internal.js', - format: 'es' - } - } + file: 'store.js', + format: 'cjs' + }, + external: name => name !== 'store.mjs' + }, ]; diff --git a/store.js b/store.mjs similarity index 97% rename from store.js rename to store.mjs index d22afdedee..ffdd90bf0e 100644 --- a/store.js +++ b/store.mjs @@ -1,4 +1,4 @@ -import { run_all, noop } from './internal.js'; +import { run_all, noop } from './internal'; export function readable(start, value) { const subscribers = [];