The decorators plugin, when .version is '2018-09' or not specified, requires a 'decoratorsBeforeExport' option, whose value must be a boolean.

 There are solution such as this, but it just couldn't work for me. Then I came across this. It made me wonder, what if the problem lies within the webpack.config.js. So, I went on and modified my webpack.config.js, and voila, it actually worked. 

Here was my original webpack.config.js configuration:

// webpack.config.js
module.exports = {

    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
          },
        },
      ],
    },
  };
 

I removed this syntax:

        use: {
            loader: 'babel-loader',
          },

and it worked!


Also, if it still won't work, try creating a new bale.config.js file, and add the following into the file

{
    "presets": ["next/babel"],
    "plugins": [
      ["@babel/plugin-proposal-decorators", {"legacy": true}]
    ]
  }

and if you are using webpack, add the following code into webpack.config.js

// webpack.config.js
module.exports = {

    presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
    plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
    { decoratorsBeforeExport: false }
  };
 


Comments

Popular posts from this blog

Support for the experimental syntax 'decorators' isn't currently enabled (5:3):

How to add environment variables into Heroku container

Running CQL scripts in Cassandra