Skip to content

Commit

Permalink
fix: fix postinstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Mar 18, 2022
1 parent 7de0803 commit 1dd108a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/vue-inbrowser-compiler-demi/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,28 @@ function updateIndexForVue3() {
const indexPath = path.join(__dirname, './index.cjs.js')
const indexContent = `
const Vue = require('vue')
module.exports.h = Vue.h
module.exports.resolveComponent = Vue.resolveComponent
module.exports.isVue3 = true
`
fs.writeFile(indexPath, indexContent)
fs.writeFile(indexPath, indexContent, err => {
if (err) {
console.error(err)
}
})

// esm
const indexPathESM = path.join(__dirname, './index.esm.js')
const indexContentESM = `
export { h, resolveComponent } from 'vue'
export const isVue3 = true`
fs.writeFile(indexPathESM, indexContentESM)
export const isVue3 = true
`
fs.writeFile(indexPathESM, indexContentESM, err => {
if (err) {
console.error(err)
}
})
}

if (pkg.version.startsWith('3.')) {
Expand Down

0 comments on commit 1dd108a

Please sign in to comment.