From 9a125a27b3263ae2328bb80a228bdb5de83d6fbf Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 7 May 2021 20:33:41 +0800 Subject: [PATCH] fix(v4): fix modern mode optional chaining syntax tranpilation (#6459) closes #6449 --- packages/@vue/babel-preset-app/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/@vue/babel-preset-app/index.js b/packages/@vue/babel-preset-app/index.js index a87ebfbbef..4f5496769d 100644 --- a/packages/@vue/babel-preset-app/index.js +++ b/packages/@vue/babel-preset-app/index.js @@ -50,7 +50,14 @@ function getModernTargets (targets) { ) // use the intersection of modern mode browsers and user defined targets config - return getIntersectionTargets(targets, allModernTargets) + const result = getIntersectionTargets(targets, allModernTargets) + + // webpack 4 uses acorn 6, which does not support newer syntaxes such as optional chaining + // so we have to add samsung 12 as a target to force transpiling these syntaxes + // https://github.com/vuejs/vue-cli/issues/6449#issuecomment-828559068 + result.samsung = '12.0.0' + + return result } function getWCTargets (targets) {