A
A
Arioch2019-08-16 15:35:48
JavaScript
Arioch, 2019-08-16 15:35:48

Babel on Nuxt doesn't work (all sorts of ES6 things like "const" remain in the code), how to fix it?

I generate a static project in Nuxt, but for some reason it does not bring it to the ES5 format (I need it to be without const, etc.).
Tried setting up Babel myself.

$ npm install --save-dev @babel/preset-env
$ npm install --save @babel/runtime
$ npm install --save-dev @babel/plugin-transform-runtime

nuxt.config.js
build: {
        babel: {
            "presets": ["@babel/preset-env"],
            "plugins": [
                ["@babel/transform-runtime"]
            ]
        }
    }

It still generates a static site using const - what to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2019-08-16
@delphinpro

Customize .browserlistrc.
Let and Const are well supported and in the default setting they seem to be allowed.

For browser- or Electron-based projects, we recommend using a .browserslistrc file to specify targets. You may already have this configuration file as it is used by many tools in the ecosystem, like autoprefixer, stylelint, eslint-plugin-compat and many others.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question