Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require("path")
- const HtmlWebpackPlugin = require("html-webpack-plugin")
- const MinifyPlugin = require("babel-minify-webpack-plugin")
- const ProgressPlugin = require("progress-webpack-plugin")
- const glob = require("glob")
- const prod = process.env.NODE_ENV === "production"
- let plugins = [
- new HtmlWebpackPlugin({
- template: "src/pages/index.html",
- filename: "index.html",
- inject: true
- }),
- new ProgressPlugin({ colors: true })
- ]
- if (prod)
- plugins.push(new MinifyPlugin({}, { comments: false }))
- const entries = glob.sync("./src/scripts/**/*.js", {})
- module.exports = {
- entry: entries,
- output: {
- filename: "main.js",
- path: path.resolve(__dirname, "dist"),
- },
- mode: prod ? "production" : "development",
- plugins: plugins,
- module: {
- rules: [
- {
- test: /\.m?jsx?/,
- exclude: /node_modules/,
- use: ["eslint-loader", "babel-loader"]
- },
- {
- "test": /\.css/,
- use: {
- loader: "css-loader"
- }
- },
- {
- test: /\.(png|jpe?g|gif)$/i,
- use: [
- {
- loader: "file-loader",
- },
- ],
- }
- ]
- },
- resolve: {
- extensions: [".jsx", ".js", ".json"]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment