Skip to content

Instantly share code, notes, and snippets.

@BishopKO
Created July 1, 2020 19:49
Show Gist options
  • Save BishopKO/aa6629bd7c83abea9f353c87e9678780 to your computer and use it in GitHub Desktop.
Save BishopKO/aa6629bd7c83abea9f353c87e9678780 to your computer and use it in GitHub Desktop.
Basic ReactJS and Django config
npm i -D @babel/core babel-loader @babel/preset-env @babel/preset-react babel-plugin-transform-class-properties
npm i react react-dom
npm i webpack webpack-cli
.babelrc:
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["transform-class-properties"]
}
webpack.config.js:
module.exports ={
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader : "babel-loader"
}
}
]
}
};
package.json:
"dev": "webpack --mode development ./django_react/frontend/src/index.js --output ./django_react/frontend/main.js"
"build": "webpack --mode production ./django_react/frontend/src/index.js --output ./django_react/frontend/main.js"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment