From bfa8530fc60deada634c38cfd6a23ab8ca05d47c Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 4 Jan 2021 17:39:29 -0500 Subject: [PATCH] perf(plugin-vue-jsx): only gen source map when necessary --- packages/plugin-vue-jsx/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/plugin-vue-jsx/index.js b/packages/plugin-vue-jsx/index.js index d70f7395a48d9e..68f1b76d31c993 100644 --- a/packages/plugin-vue-jsx/index.js +++ b/packages/plugin-vue-jsx/index.js @@ -10,6 +10,7 @@ const hash = require('hash-sum') */ module.exports = function vueJsxPlugin(options = {}) { let needHmr = false + let needSourceMap = true return { name: 'vue-jsx', @@ -31,6 +32,7 @@ module.exports = function vueJsxPlugin(options = {}) { configResolved(config) { needHmr = config.command === 'serve' && !config.isProduction + needSourceMap = config.command === 'serve' || !!config.build.sourcemap }, transform(code, id) { @@ -47,7 +49,7 @@ module.exports = function vueJsxPlugin(options = {}) { const result = babel.transformSync(code, { ast: true, plugins, - sourceMaps: true, + sourceMaps: needSourceMap, sourceFileName: id })