Skip to content

Commit

Permalink
fix: use mjs and cjs, close #71
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 15, 2021
1 parent 6d1782d commit 8c411b0
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 7 additions & 6 deletions package.json
Expand Up @@ -5,16 +5,17 @@
"funding": "https://github.com/sponsors/antfu",
"license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"main": "lib/index.cjs.js",
"main": "lib/index.cjs",
"jsdelivr": "lib/index.iife.js",
"unpkg": "lib/index.iife.js",
"module": "lib/index.esm.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"require": "./lib/index.cjs.js",
"node": "./lib/index.cjs.js",
"browser": "./lib/index.esm.js"
"require": "./lib/index.cjs",
"node": "./lib/index.cjs",
"import": "./lib/index.mjs",
"browser": "./lib/index.mjs"
},
"./*": "./*"
},
Expand All @@ -29,7 +30,7 @@
],
"scripts": {
"postinstall": "node ./scripts/postinstall.js",
"release": "npx bumpp --tag --commit --push && npm publish"
"release": "npx bumpp --tag --commit --push && npm publish --tag next"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
Expand Down
6 changes: 3 additions & 3 deletions scripts/utils.js
Expand Up @@ -30,7 +30,7 @@ function updateVue2API() {

const exports = Object.keys(VCA).filter(i => !ignoreList.includes(i))

const esmPath = path.join(dir, 'index.esm.js')
const esmPath = path.join(dir, 'index.mjs')
let content = fs.readFileSync(esmPath, 'utf-8')

content = content.replace(
Expand All @@ -45,8 +45,8 @@ export { ${exports.join(', ')} } from '@vue/composition-api'
}

function switchVersion(version, vue) {
copy('index.cjs.js', version, vue)
copy('index.esm.js', version, vue)
copy('index.cjs', version, vue)
copy('index.mjs', version, vue)
copy('index.d.ts', version, vue)

if (version === 2)
Expand Down

0 comments on commit 8c411b0

Please sign in to comment.