Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parser "babylon" deprecated error - webpack build

After I have been upgrading my projects JS packages, an error has appeared when building my bundle with Webpack. It seems to appear when building a .vue-file and can appear on any .vue-file build. I don't have "babylon" in my package.json and I have a newer @babel/core version (7.2.2).

This is the error:

{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }

It only seems to appear when building .vue-files.

Here's my configuration:

.babelrc

{
  "presets": ["@babel/preset-env"],
  "plugins": ["@babel/plugin-transform-regenerator"]
}

Webpack config:

module: {
rules: [
  {
    enforce: 'pre',
    test: /\.(js|vue)$/,
    loader: 'eslint-loader',
    exclude: /node_modules/
  },
  {
    test: /\.vue$/,
    loader: 'vue-loader',
    options: {
      loaders: {
        scss: 'vue-style-loader!css-loader!sass-loader',
        sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
      }
    }
  },
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: [ 'babel-loader' ]
  },
  {
    test: /\.sass$/,
    exclude: /node_modules/,
    use: ExtractTextPlugin.extract({
      fallback: 'style-loader',
      use: [
        {
          loader: 'css-loader',
          options: {
            sourceMap: true
          }
        },
        {
          loader: 'postcss-loader',
          options: {
            sourceMap: true
          }
        },
        {
          loader: 'sass-loader',
          options: {
            sourceMap: true
          }
        }
      ]
    })
  }
]

}

.eslintrc.js

  extends: [
'eslint:recommended',
'plugin:vue/recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
 settings: {
'import/resolver': {
  'node': {
    'extensions': [
      '.js',
      '.vue'
    ]
  }
 }
 },
  parserOptions: {
  parser: 'babel-eslint',
  ecmaVersion: 2018
 }

package.json

"dependencies": {
    "@fortawesome/fontawesome-free": "^5.1.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.10",
    "@fortawesome/free-solid-svg-icons": "^5.6.1",
    "@fortawesome/vue-fontawesome": "^0.1.3",
    "autoprefixer": "^9.4.6",
    "axios": "^0.18.0",
    "babel-eslint": "^10.0.1",
    "babel-polyfill": "^6.23.0",
    "backbone": "^1.3.3",
    "bulma": "^0.7.1",
    "bulma-calendar": "^5.0.3",
    "clean-webpack-plugin": "^1.0.1",
    "css-loader": "^0.28.4",
    "extract-text-webpack-plugin": "^3.0.0",
    "flickity": "^2.0.9",
    "flickity-imagesloaded": "^2.0.0",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "glob-all": "^3.1.0",
    "in-view": "^0.6.1",
    "jquery": "^3.2.1",
    "js-cookie": "^2.2.0",
    "lazysizes": "^4.0.2",
    "magnific-popup": "^1.1.0",
    "node-pre-gyp": "^0.12.0",
    "node-sass": "^4.7.2",
    "optimize-css-assets-webpack-plugin": "^3.0.0",
    "postcss-loader": "^3.0.0",
    "purify-css": "^1.2.5",
    "purifycss-webpack": "^0.7.0",
    "sass-loader": "^6.0.7",
    "style-loader": "^0.18.2",
    "underscore": "^1.8.3",
    "vue": "2.5.22",
    "vue-affix": "^0.2.4",
    "vue-lazyload": "^1.2.6",
    "vue-loader": "13.7.2",
    "vue-template-compiler": "2.5.22",
    "vuex": "^3.0.1",
    "webpack": "^3.4.1",
    "webpack-bundle-analyzer": "^2.8.3",
    "webpack-bundle-tracker": "^0.2.0",
    "webpack-dev-server": "^2.6.1",
    "webpack-merge": "^4.1.0"
},
"devDependencies": {
    "@babel/core": "^7.2.2",
    "@babel/plugin-transform-regenerator": "^7.0.0",
    "@babel/preset-env": "^7.3.1",
    "babel-loader": "^8.0.5",
    "eslint": "^4.14.0",
    "eslint-loader": "^2.1.1",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-vue": "4.7.1"
}
like image 922
Kris D. J. Avatar asked Jan 22 '19 10:01

Kris D. J.


Video Answer


1 Answers

The problem comes from vue-loader 13.x.x and 14.x.x

Version 15.x.x seems to be fine, but I cannot update my project to 15.x.x without breaking everything. (I guess you'll have the same issue)

I'll log an issue in the project repo and with a bit of lucky they'll release a fix.

EDIT:

For the time being, you can use a forked version of 14.2.2 that I have created to get rid of the message. Not sure if it would be compatible with your build.

Try to replace:

"vue-loader": "13.7.2",

with

"vue-loader": "https://github.com/graux/vue-loader#a0d6b77",
like image 160
Fran Avatar answered Nov 10 '22 21:11

Fran