A
A
Alexander Ivanov2019-07-20 18:10:55
React
Alexander Ivanov, 2019-07-20 18:10:55

How to fix Plugin/Preset files are not allowed.. error?

Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\projects\js\chat\node_modules\babel-preset-stage-0\lib\index.js

/* webpack */
module.exports = {
  entry: [__dirname +'/src/index.js'],
  output: {
    path: __dirname + '/public',
    filename: 'bundle.js'
  },
  devtool: 'source-maps',
  module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                loader: "babel-loader",
                query: {
                    presets: ["env", "stage-0", "react"]
                },
            }
        ]
    },
    plugins: []
}
/* */
// package
{
    "name": "react-boilerplate",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "start": "webpack --mode development --watch",
        "build": "webpack --mode production",
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "@babel/core": "^7.5.5",
        "@babel/preset-env": "^7.5.5",
        "@babel/preset-react": "^7.0.0",
        "babel-loader": "^8.0.6",
        "babel-preset-env": "^1.7.0",
        "css-loader": "^3.1.0",
        "html-webpack-plugin": "^3.2.0",
        "style-loader": "^0.23.1",
        "webpack": "^4.36.1",
        "webpack-cli": "^3.3.6"
    },
    "dependencies": {
        "babel-preset-stage-0": "^6.24.1",
        "react": "^16.8.6",
        "react-dom": "^16.8.6"
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-07-21
@cimonlebedev

You need to demolish the old presets and , and install . How to write the configuration correctly delete in the babel-loader repository . Never set up a project toolkit on old articles on the Internet and do not use the starter repositories if there have not been any commits for at least a couple of months. babel-preset-stage-0babel-preset-env@babel/preset-stage-0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question