M
M
maksmaksimovich2018-09-30 23:03:40
JavaScript
maksmaksimovich, 2018-09-30 23:03:40

Doesn't recognize jsx when I add package.json, how to fix it?

There is an App.jsx file, everything
<h1>Hello World</h1>
works fine in it in rendering, but if I put this file in a separate folder and next to the file I create a package.json file with the following content:

{
  "name": "App",
  "main": "App.jsx"
}

Then it starts to swear at the h1 tag in the App.jsx render

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-09-30
@maksmaksimovich

...but if I put this file in a separate folder and next to the file I create a package.json file with the following content...

What for?
Learn the basics of npm and wepack urgently.
If you want to build the bundle from another directory, change the path in the entry property of the webpack config:
module.exports = {
  entry: './path/to/my/entry/file.js'
};

package.json does not need to be added, this file is for other purposes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question