Skip to content

Commit d317237

Browse files
committed
feat: add exports field + mjs build
1 parent 5673363 commit d317237

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

compiler-sfc/index.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@vue/compiler-sfc'

compiler-sfc/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"main": "index.js",
3+
"module": "index.mjs",
34
"types": "index.d.ts"
45
}

package.json

+16
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515
"compiler-sfc",
1616
"packages/compiler-sfc"
1717
],
18+
"exports": {
19+
".": {
20+
"import": {
21+
"node": "./dist/vue.runtime.mjs",
22+
"default": "./dist/vue.runtime.esm.js"
23+
},
24+
"require": "./dist/vue.runtime.common.js",
25+
"types": "./types/index.d.ts"
26+
},
27+
"./compiler-sfc": {
28+
"import": "./compiler-sfc/index.mjs",
29+
"require": "./compiler-sfc/index.js"
30+
},
31+
"./dist/*": "./dist/*",
32+
"./types/*": "./types/*"
33+
},
1834
"sideEffects": false,
1935
"scripts": {
2036
"dev": "rollup -w -c scripts/config.js --environment TARGET:full-dev",

scripts/config.js

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ const builds = {
6565
format: 'es',
6666
banner
6767
},
68+
// Runtime only ES modules build (for Node)
69+
'runtime-mjs': {
70+
entry: resolve('web/entry-runtime-esm.ts'),
71+
dest: resolve('dist/vue.runtime.mjs'),
72+
format: 'es',
73+
banner
74+
},
6875
// Runtime+compiler ES modules build (for bundlers)
6976
'full-esm': {
7077
entry: resolve('web/entry-runtime-with-compiler-esm.ts'),

0 commit comments

Comments
 (0)