Last active
February 13, 2017 19:34
-
-
Save k88hudson/c10a9f29e51b8b4c3a3ab2b47186901b to your computer and use it in GitHub Desktop.
Bare-bones react/webpack set-up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* First, install dependencies: | |
npm install webpack babel-loader babel-core babel-preset-react --save-dev | |
npm install react react-dom --save | |
Note: babel dependencies are not needed if you aren't using jsx) | |
*/ | |
// webpack.config.js | |
// Note: This assumes a "main.js" file in a src/ directory, and outputs "main.bundle.js" to a dist/ directory | |
module.exports = { | |
entry: "./src/main.js", | |
output: { | |
path: "./dist", | |
filename: "main.bundle.js" | |
}, | |
// Below here is only if you need jsx | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
// You may alternatively choose to *include* your src directory. | |
exclude: /node_modules/, | |
loader: "babel-loader", | |
query: {presets: ["react"]} | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment