diff --git a/packages/babel-preset-app/package.json b/packages/babel-preset-app/package.json index 9e378f19c1..ceb8f6982d 100644 --- a/packages/babel-preset-app/package.json +++ b/packages/babel-preset-app/package.json @@ -14,6 +14,8 @@ "@babel/helper-compilation-targets": "^7.10.4", "@babel/plugin-proposal-class-properties": "^7.10.4", "@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/preset-env": "^7.11.5", "@babel/runtime": "^7.11.2", diff --git a/packages/babel-preset-app/src/index.js b/packages/babel-preset-app/src/index.js index 23d6005466..360452b470 100644 --- a/packages/babel-preset-app/src/index.js +++ b/packages/babel-preset-app/src/index.js @@ -159,6 +159,12 @@ module.exports = (api, options = {}) => { 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 { sourceType: 'unambiguous', presets,