UNPKG

react-responsive-gallery-custom

Version:
85 lines (83 loc) 2.06 kB
const path = require("path"); const PrettierPlugin = require("prettier-webpack-plugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); // const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const BrotliPlugin = require("brotli-webpack-plugin"); module.exports = { entry: "./src/index.js", output: { path: path.resolve(__dirname, "build"), filename: "index.js", libraryTarget: "commonjs2", }, plugins: [ new PrettierPlugin(), // new BundleAnalyzerPlugin(), new BrotliPlugin({ asset: "[path].br[query]", test: /\.(js|css|html|svg)$/, threshold: 10240, minRatio: 0.8, }), ], optimization: { minimizer: [new UglifyJsPlugin()], }, module: { rules: [ { test: /\.js$/, include: path.resolve(__dirname, "src"), exclude: /(node_modules|bower_components|build)/, use: { loader: "babel-loader", options: { presets: ["@babel/preset-env"], }, }, }, { test: /\.module\.s(a|c)ss$/, loader: [ "style-loader", { loader: "css-loader", options: { modules: true, localIdentName: "[name]__[local]___[hash:base64:5]", camelCase: true, sourceMap: true, }, }, { loader: "sass-loader", options: { sourceMap: true, }, }, ], }, { test: /\.s(a|c)ss$/, exclude: /\.module.(s(a|c)ss)$/, loader: [ "style-loader", "css-loader", { loader: "sass-loader", options: { sourceMap: true, }, }, ], }, { test: /\.css$/i, use: ["style-loader", "css-loader"], }, ], }, externals: { react: "commonjs react", }, };