Skip to content

Instantly share code, notes, and snippets.

@k88hudson
Last active February 13, 2017 19:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k88hudson/c10a9f29e51b8b4c3a3ab2b47186901b to your computer and use it in GitHub Desktop.
Save k88hudson/c10a9f29e51b8b4c3a3ab2b47186901b to your computer and use it in GitHub Desktop.
Bare-bones react/webpack set-up
/* 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