D
D
Daniil Sugonyaev2018-03-04 11:07:33
React
Daniil Sugonyaev, 2018-03-04 11:07:33

Webpack not working with react 16?

I can’t make friends with the react 16 syntax with the webpack assembly https://yadi.sk/i/CW-BOZAZ3SywSo
At the same time, the previous syntax works well:

go() {

}

There will be no error.
File configuration:
{
                test: /\.js$/,
                exclude: /node_modules/,
                use: [{
                    loader: "babel-loader",
                        options: {
                        "presets": ["env"]
                    }
                }]
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                use: [{
                    loader: "babel-loader",
                        options: {
                        presets: ["env", "react"]
                    }
                }]
            }

        ]
    },

package.json
{
  "name": "web",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "webpack --config webpack.build.js --mode production",
    "dev": "webpack-dev-server --watch --hot --config webpack.dev.js --mode development"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "autoprefixer": "^8.1.0",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.3",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-react-app": "^3.1.1",
    "browser-sync": "^2.23.6",
    "browser-sync-webpack-plugin": "^2.0.1",
    "clean-webpack-plugin": "^0.1.18",
    "css-loader": "^0.28.9",
    "cssnano": "^3.10.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.10",
    "group-css-media-queries-loader": "^1.0.4",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.0.4",
    "image-webpack-loader": "^4.1.0",
    "pixel-glass": "^1.0.13",
    "postcss-assets": "^5.0.0",
    "postcss-center": "^1.1.0",
    "postcss-clearfix": "^2.0.1",
    "postcss-discard-duplicates": "^2.1.0",
    "postcss-focus": "^3.0.0",
    "postcss-inline-media": "^1.0.1",
    "postcss-load-config": "^1.2.0",
    "postcss-loader": "^2.1.1",
    "postcss-merge-longhand": "^3.0.0",
    "postcss-pxtorem": "^4.0.1",
    "postcss-responsive-font": "^1.0.3",
    "postcss-responsive-images": "^1.0.3",
    "postcss-size": "^2.0.0",
    "postcss-zindex": "^2.2.0",
    "purify-css": "^1.2.6",
    "purifycss-webpack-plugin": "^2.0.3",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "smart-grid": "^2.0.1",
    "style-loader": "^0.20.2",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "webpack": "^4.0.1",
    "webpack-cli": "^2.0.9",
    "webpack-dev-server": "^3.1.0",
    "webpack-merge": "^4.1.2",
    "webpack-php-loader": "^0.5.0",
    "webpack-spritesmith": "^0.4.0"
  },
  "dependencies": {
    "custom-scroll": "git+https://github.com/standy/custom-scroll.git",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "owl.carousel": "^2.2.0"
  }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question