Skip to content

Instantly share code, notes, and snippets.

@mr-vaibh
Last active August 3, 2021 16:14
Show Gist options
  • Save mr-vaibh/4d59310e5179689f2c4b206d3f19d7fa to your computer and use it in GitHub Desktop.
Save mr-vaibh/4d59310e5179689f2c4b206d3f19d7fa to your computer and use it in GitHub Desktop.
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "./dist"),
filename: "[name].bundle.js",
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"]
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: "file-loader",
options: {
publicPath: '/dist',
useRelativePaths: true
}
}
]
}
],
},
optimization: {
minimize: true,
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
// This has effect on the react lib size
NODE_ENV: JSON.stringify("development"),
},
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment