Skip to content

Instantly share code, notes, and snippets.

@cziem
Created November 3, 2018 21:29
Show Gist options
  • Save cziem/d6d37f1d834c88e18a9725c263ea1492 to your computer and use it in GitHub Desktop.
Save cziem/d6d37f1d834c88e18a9725c263ea1492 to your computer and use it in GitHub Desktop.
webpack custom configuration for mern stack application
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: "./client/src/index.js",
output: {
path: path.resolve(__dirname, "./dist"),
filename: "index-bundle.js"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
},
{
test: /\.s?css$/,
use: ["style-loader", "css-loader", "sass-loader"]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: "./client/public/index.html"
})
],
devtool: "cheap-module-eval-source-map",
devServer: {
contentBase: path.resolve(__dirname, "./dist")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment