Skip to content

Commit cedbae9

Browse files
committed
perf(plugin-vue-jsx): only gen source map when necessary
1 parent 1cd0590 commit cedbae9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: packages/plugin-vue-jsx/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const hash = require('hash-sum')
1010
*/
1111
module.exports = function vueJsxPlugin(options = {}) {
1212
let needHmr = false
13+
let needSourceMap = true
1314

1415
return {
1516
name: 'vue-jsx',
@@ -31,6 +32,7 @@ module.exports = function vueJsxPlugin(options = {}) {
3132

3233
configResolved(config) {
3334
needHmr = config.command === 'serve' && !config.isProduction
35+
needSourceMap = config.command === 'serve' || !!config.build.sourcemap
3436
},
3537

3638
transform(code, id) {
@@ -47,7 +49,7 @@ module.exports = function vueJsxPlugin(options = {}) {
4749
const result = babel.transformSync(code, {
4850
ast: true,
4951
plugins,
50-
sourceMaps: true,
52+
sourceMaps: needSourceMap,
5153
sourceFileName: id
5254
})
5355

0 commit comments

Comments
 (0)