D
D
Danil Kislov2020-11-09 18:49:38
React
Danil Kislov, 2020-11-09 18:49:38

Why is React not compiling with webpack?

I connect Django and React.js according to this article. files are the same + babel.config.json file:

{
  "presets": ["@babel/preset-react", "@babel/preset-env"],
  "plugins": ["@babel/plugin-transform-react-jsx"]
}


After the npm run dev command, compilation proceeds without errors, but the main.js file after it remains empty. Compilation log:
[webpack-cli] Compilation finished
asset main.js 1.02 MiB [emitted] (name: main)
runtime modules 668 bytes 3 modules
modules by path ./node_modules/ 979 KiB
  modules by path ./node_modules/scheduler/ 31.8 KiB 4 modules
  modules by path ./node_modules/react/ 70.6 KiB
    ./node_modules/react/index.js 190 bytes [built] [code generated]
    ./node_modules/react/cjs/react.development.js 70.5 KiB [built] [code generated]
  modules by path ./node_modules/react-dom/ 875 KiB
    ./node_modules/react-dom/index.js 1.33 KiB [built] [code generated]
    ./node_modules/react-dom/cjs/react-dom.development.js 874 KiB [built] [code generated]
  ./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 3.63 KiB
  ./src/index.js 38 bytes [built] [code generated]
  ./src/components/App.js 3.59 KiB [built] [code generated]
./static/frontend/main.js 1 bytes [built] [code generated]
webpack 5.3.2 compiled successfully in 3051 ms


What is the reason?

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