Created
November 3, 2018 21:29
-
-
Save cziem/d6d37f1d834c88e18a9725c263ea1492 to your computer and use it in GitHub Desktop.
webpack custom configuration for mern stack application
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
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