const path = require("path"); module.exports = (env, argv) => { return { devtool: "source-map", mode: argv.mode === "production" ? "production" : "development", entry: [ path.resolve(__dirname, "./src/ts/index.ts"), path.resolve(__dirname, "./src/scss/themes/standard.scss") ], output: { clean: true, path: path.resolve(__dirname, "./dist/umd"), // builds to ./dist/umd/ filename: "[name].js", // index.js library: "CookieNotice", // aka window.CookieNotice libraryTarget: "umd", // supports commonjs, amd and web browsers globalObject: "this" }, module: { rules: [ { test: /\.t|js$/, use: { loader: "babel-loader", options: { babelrc: true } } }, { test: /\.s[ac]ss$/i, exclude: /node_modules/, type: "asset/resource", generator: { filename: "css/[name].css" }, use: [ { loader: "sass-loader", options: { sourceMap: true, // Prefer `dart-sass` implementation: require("sass"), }, } ] } ] }, stats: { errorDetails: true, children: true }, resolve: { extensions: [".tsx", ".ts", ".js"], fallback: { fs: false, path: false, }, }, }; };