-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I discovered this repo from a FreeCodeCamp blog post (https://www.freecodecamp.org/news/an-intro-to-webpack-what-it-is-and-how-to-use-it-8304ecdc3c60/) but it is fairly out of date with what was talked about in that post.
Project layout
The blog refers to a components folder but this repo does not have one. I put the App.js file directly in the src folder and updated the import statement in index.js:
import App from './App';Index.html
The index.html should look like this. The script should use the bundle.js file mentioned in the webpack.config.js file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Webpack React</title>
</head>
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
</html>Babel presets
The correct .babelrc looks like this:
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "entry",
"corejs": "3.22"
}
],
["@babel/preset-react"]
]
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels