Skip to content

Commit

Permalink
feat: add exports field + mjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 1, 2022
1 parent 5673363 commit d317237
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler-sfc/index.mjs
@@ -0,0 +1 @@
export * from '@vue/compiler-sfc'
1 change: 1 addition & 0 deletions compiler-sfc/package.json
@@ -1,4 +1,5 @@
{
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts"
}
16 changes: 16 additions & 0 deletions package.json
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions scripts/config.js
Expand Up @@ -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'),
Expand Down

2 comments on commit d317237

@8005707
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@8005707
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

01 01 22

Please sign in to comment.