Skip to content

Commit 672fcde

Browse files
committed
chore: fix build
1 parent 21d7b36 commit 672fcde

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,31 @@
1818
},
1919
"scripts": {
2020
"dev": "unbuild --stub",
21-
"build": "unbuild && pnpm run patch-cjs",
22-
"patch-cjs": "esno ../../scripts/patchCJS.ts",
21+
"build": "unbuild && esno scripts/patchCJS.ts",
2322
"prepublishOnly": "npm run build"
2423
},
2524
"engines": {
2625
"node": ">=14.6.0"
2726
},
2827
"repository": {
2928
"type": "git",
30-
"url": "git+https://github.com/vitejs/vite.git",
29+
"url": "git+https://github.com/vitejs/vite-plugin-vue2.git",
3130
"directory": "packages/plugin-vue"
3231
},
3332
"bugs": {
34-
"url": "https://github.com/vitejs/vite/issues"
33+
"url": "https://github.com/vitejs/vite-plugin-vue2/issues"
3534
},
36-
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue#readme",
35+
"homepage": "https://github.com/vitejs/vite-plugin-vue2/#readme",
3736
"peerDependencies": {
3837
"vite": ">=2.5.10",
39-
"vue": "^2.7.0-alpha"
38+
"vue": "^2.7.0-0"
4039
},
4140
"devDependencies": {
42-
"@jridgewell/gen-mapping": "^0.3.1",
43-
"@jridgewell/trace-mapping": "^0.3.13",
4441
"@rollup/pluginutils": "^4.2.1",
4542
"debug": "^4.3.4",
4643
"esno": "^0.16.3",
4744
"hash-sum": "^2.0.0",
45+
"picocolors": "^1.0.0",
4846
"rollup": "^2.75.6",
4947
"slash": "^4.0.0",
5048
"source-map": "^0.6.1",

pnpm-lock.yaml

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/patchCJS.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,15 @@ if (matchMixed) {
4141
writeFileSync(indexPath, lines.join('\n'))
4242

4343
console.log(colors.bold(`${indexPath} CJS patched`))
44-
process.exit()
45-
}
46-
47-
const matchDefault = code.match(/\nmodule.exports = (\w+);/)
48-
49-
if (matchDefault) {
50-
code += `module.exports["default"] = ${matchDefault[1]};\n`
51-
writeFileSync(indexPath, code)
52-
console.log(colors.bold(`${indexPath} CJS patched`))
53-
process.exit()
44+
} else {
45+
const matchDefault = code.match(/\nmodule.exports = (\w+);/)
46+
47+
if (matchDefault) {
48+
code += `module.exports["default"] = ${matchDefault[1]};\n`
49+
writeFileSync(indexPath, code)
50+
console.log(colors.bold(`${indexPath} CJS patched`))
51+
} else {
52+
console.error(colors.red(`${indexPath} CJS patch failed`))
53+
process.exit(1)
54+
}
5455
}
55-
56-
console.error(colors.red(`${indexPath} CJS patch failed`))
57-
process.exit(1)

0 commit comments

Comments
 (0)