fix(babel-preset-app): always transpile optional chaining and nullish-coalescing for server (#8203)

This commit is contained in:
pooya parsa 2020-10-14 16:02:13 +02:00 committed by GitHub
parent d9f48228fe
commit c75ac80f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,8 @@
"@babel/helper-compilation-targets": "^7.10.4", "@babel/helper-compilation-targets": "^7.10.4",
"@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-proposal-decorators": "^7.10.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
"@babel/plugin-transform-runtime": "^7.11.5", "@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5", "@babel/preset-env": "^7.11.5",
"@babel/runtime": "^7.11.2", "@babel/runtime": "^7.11.2",

View File

@ -159,6 +159,12 @@ module.exports = (api, options = {}) => {
absoluteRuntime absoluteRuntime
}]) }])
// https://github.com/nuxt/nuxt.js/issues/7722
if (envName === 'server') {
plugins.push(require('@babel/plugin-proposal-optional-chaining'))
plugins.push(require('@babel/plugin-proposal-nullish-coalescing-operator'))
}
return { return {
sourceType: 'unambiguous', sourceType: 'unambiguous',
presets, presets,