Skip to content

Instantly share code, notes, and snippets.

@carrieforde
Last active July 25, 2020 23:16
Show Gist options
  • Save carrieforde/5b59a40389673f9d549b543eb636a0c2 to your computer and use it in GitHub Desktop.
Save carrieforde/5b59a40389673f9d549b543eb636a0c2 to your computer and use it in GitHub Desktop.
Creating multiple output files
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
context: __dirname,
entry: {
block_one: ["./block-one/index.js", "./block-one/styles.css"],
block_two: ["./block-two/index.js", "./block-two/styles.css"],
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name]/bundle.js",
},
mode: "development",
module: {
rules: [
{
test: /\.jsx?$/,
loader: "babel-loader",
},
{
test: /\.s?css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name]/styles.css",
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment