I seem to have react-scripts and webpack in conflict. There is a small project with such configs:
package.json
{ "name": "todo_react", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.3.2", "react-dom": "^16.3.2", "react-scripts": "1.1.4" }, "scripts": { "start": "webpack", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "devDependencies": { "babel-core": "^6.26.3", "babel-loader": "^7.1.4", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "webpack": "^4.8.1", "webpack-cli": "^2.1.3" } } First, instead of "start": "webpack" was "start": "react-scripts start", однако при выполнении команды npm start` command, an error occurred:
Cannot read property 'thisCompilation' of undefined
Config for webpack such:
var path = require('path'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: "babel-loader" }, { test: /\.jsx?$/, exclude: /node_modules/, use: "babel-loader" }, { test: /\.css$/, use: [ { loader: "style-loader" }, { loader: "css-loader" } ] } ] } }; I said that this error may occur due to the simultaneous presence of react-scripts and webpack in package.json. It is even advised to remove node_moules , webpack and reinstall everything. And how can it be easier to solve this problem?
I need the ability to conveniently run the project using npm start and use the webpack.