W
W
Wasya UK2018-10-17 14:44:41
JavaScript
Wasya UK, 2018-10-17 14:44:41

Plugin/Preset files are not allowed?

I took working code from an old project, but I get an error Plugin/Preset files are not allowed to export objects, only functions. a bunch of @babel/... tried it, what could be wrong?
common webpack:

module.exports = {
  output: {
    path: path.resolve(__dirname, '../dist'),
    filename: '[name].js'
  },
  module: {
    rules: [
      {
        test: /\.(m?js|jsx)$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['env', 'es2017', 'es2015', 'stage-3'],
            plugins: ['transform-runtime']
          }
        }
      }
    ]
  },
  resolve: {
    extensions: ['*', '.js', '.jsx']
  },
  optimization: {
    minimize: false
  }
};

package.json:
"devDependencies": {
    "@babel/core": "^7.1.2",
    "@babel/preset-env": "^7.1.0",
    "@babel/preset-es2017": "^7.0.0-beta.53",
    "@babel/preset-react": "^7.0.0",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.4",
    "babel-minify-webpack-plugin": "^0.3.1",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-es2017": "^6.24.1",
    "babel-preset-minify": "^0.5.0",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "babel-preset-stage-3": "^6.24.1",
    "html-webpack-plugin": "^3.2.0",
    "install": "^0.12.2",
    "nodemon": "^1.18.4",
    "npm": "^6.4.1",
    "transform-runtime": "0.0.0",
    "webpack": "^4.20.2",
    "webpack-cli": "^3.1.2",
    "webpack-dev-server": "^3.1.9",
    "webpack-merge": "^4.1.4"
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wasya UK, 2018-10-17
@dmc1989

{
        test: /\.(m?js|jsx)$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/env', '@babel/react']
          }
        }
      }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question