ES6 syntax error of Vue project


Problems encountered during code base migration

1. Do not recognize ES6 syntax

Extended operators… Error reporting

ES6 syntax error of Vue project

… is the object expansion operator of ES6, which is not supported by Babel at present. A new package needs to be introduced to solve this problem. To install a Babel plug-in to translate the object expansion operator syntax.


npm install babel-plugin-transform-object-rest-spread

Create the. Babelrc file in the root directory

In the. Babelrc file, write:

    "presets": [
        ["es2015", { "modules": false }]
    "Plugins": ["transform object rest spread"] // unable to parse ES6 syntax key solution

2. error reporting

ModuleBuildError: Module build failed: Error: No PostCSS Config found in:XXX

ES6 syntax error of Vue project


Create the postcss.config.js file in the root directory
Write in postcss.config.js

module.exports = { 
    plugins: { 
        'autoprefixer': {browsers: 'last 5 version'} 

That’s amazing!!!

Recommended Today

Less cycle

In this section, we will learn the loop in less. Loops should be very common in programming languages. There are loops in general programming languages, such as in JavaScriptforCirculationwhileHowever, there are no such two kinds of syntax in less, but they are used to realize the loop through its own call. The use of recycling […]