NuxtJS with Babel 7: still have spread operator in built files
I ran into a similar issue: A Nuxt app wouldn't work in the Edge browser because of spread operators in @nuxtjs/axios and bootstrap-vue. I did find a solution.
The build property in nuxt.config.js should be defined as follows:
build: { babel: { babelrc: true, configFile: './babel.config.js' }, transpile: [ '@nuxtjs/axios', 'bootstrap-vue' ], // Other config}
The transpile property is key here. Internally, Nuxt defines an exclude for babel-loader that ignores everything in node_modules, unless it's in transpile.
Using babel.config.js also appears to matter, and the official Babel documentation says you should use it if you want to process node_modules.
babel.config.js:
module.exports = function (api) { api.cache(true); return { sourceType: 'unambiguous', presets: ['@nuxt/babel-preset-app'], plugins: ['@babel/plugin-proposal-object-rest-spread'] };}
You don't need include or exclude here, as it's taken care of by Nuxt, as noted.