How can I have both a vue.config.js and babel.config.js working together?

Viewed 858

Having added also a vue.config.js next to my babel.config.js I realized that the code doesn't get transpiled to ES5 anymore, probably because babel.config.js is fully ignored once there's a vue.config.js (?)

How can I keep babel transpiling the code when building with the presets given while yet having a vue.config.js with other configurations?

babel.config.js

module.exports = {
  presets: [['@vue/app', { useBuiltIns: 'entry', corejs: 'core-js@2' }]],
}

vue.config.js

const TerserPlugin = require('terser-webpack-plugin')

module.exports = {
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer = [
        new TerserPlugin({
          terserOptions: {
            // needed for vuex-typex to work in production:
            keep_fnames: true,
          },
        }),
      ]
    }
  },
  css: {
    loaderOptions: {
      sass: {
        data: `@import "./src/core/style/core/_variables.scss";`,
      },
    },
  },
  runtimeCompiler: true,
}
0 Answers
Related