feat: add exports field + mjs build

This commit is contained in:
Evan You 2022-06-01 10:11:19 +08:00
parent 5673363eda
commit d3172377e0
4 changed files with 25 additions and 0 deletions

1
compiler-sfc/index.mjs Normal file
View File

@ -0,0 +1 @@
export * from '@vue/compiler-sfc'

View File

@ -1,4 +1,5 @@
{
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts"
}

View File

@ -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",

View File

@ -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'),