Skip to content

Instantly share code, notes, and snippets.

@antosan
Created April 27, 2019 13:24
Show Gist options
  • Select an option

  • Save antosan/be80395b312d1085f5d5f5ff6b3a3cf7 to your computer and use it in GitHub Desktop.

Select an option

Save antosan/be80395b312d1085f5d5f5ff6b3a3cf7 to your computer and use it in GitHub Desktop.
react-webpack-demo
const path = require("path");
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "build"),
filename: "bundle.js",
publicPath: "/build/"
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: {
loader: "file-loader"
}
}
]
},
devServer: {
contentBase: path.resolve(__dirname, "public"),
port: 3000,
publicPath: "/build/",
open: true,
overlay: true
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment