diff --git a/compiler-sfc/index.mjs b/compiler-sfc/index.mjs new file mode 100644 index 00000000..3c30abc8 --- /dev/null +++ b/compiler-sfc/index.mjs @@ -0,0 +1 @@ +export * from '@vue/compiler-sfc' diff --git a/compiler-sfc/package.json b/compiler-sfc/package.json index d7ccd0a7..778c7ebf 100644 --- a/compiler-sfc/package.json +++ b/compiler-sfc/package.json @@ -1,4 +1,5 @@ { "main": "index.js", + "module": "index.mjs", "types": "index.d.ts" } diff --git a/package.json b/package.json index 6b0049d5..8b9e71fb 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,22 @@ "compiler-sfc", "packages/compiler-sfc" ], + "exports": { + ".": { + "import": { + "node": "./dist/vue.runtime.mjs", + "default": "./dist/vue.runtime.esm.js" + }, + "require": "./dist/vue.runtime.common.js", + "types": "./types/index.d.ts" + }, + "./compiler-sfc": { + "import": "./compiler-sfc/index.mjs", + "require": "./compiler-sfc/index.js" + }, + "./dist/*": "./dist/*", + "./types/*": "./types/*" + }, "sideEffects": false, "scripts": { "dev": "rollup -w -c scripts/config.js --environment TARGET:full-dev", diff --git a/scripts/config.js b/scripts/config.js index 2360c802..610e8d0a 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -65,6 +65,13 @@ const builds = { format: 'es', banner }, + // Runtime only ES modules build (for Node) + 'runtime-mjs': { + entry: resolve('web/entry-runtime-esm.ts'), + dest: resolve('dist/vue.runtime.mjs'), + format: 'es', + banner + }, // Runtime+compiler ES modules build (for bundlers) 'full-esm': { entry: resolve('web/entry-runtime-with-compiler-esm.ts'),