UNPKG

@kiyasov/noty

Version:
82 lines (75 loc) 1.82 kB
import path from "path"; import webpack from "webpack"; import OptimizeCssAssetsPlugin from "optimize-css-assets-webpack-plugin"; import TerserPlugin from "terser-webpack-plugin"; import MiniCssExtractPlugin from "mini-css-extract-plugin"; const distPath = path.join(__dirname, "/public"); export default env => { return { entry: { main: __dirname + "/index.js" }, output: { filename: "bundle.js", path: distPath }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.(sa|sc|c)ss$/, use: [ { loader: MiniCssExtractPlugin.loader }, { loader: "css-loader", options: { url: false } }, { loader: "sass-loader" } ] }, { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: "url-loader", options: { limit:100000 } } ] }, optimization: { minimizer: [ new TerserPlugin(), new OptimizeCssAssetsPlugin({ cssProcessorOptions: { discardComments: { removeAll: true } } }) ] }, plugins: [ new MiniCssExtractPlugin({ filename: `app.css` }), new webpack.LoaderOptionsPlugin({ debug: false, minimize: true }), new OptimizeCssAssetsPlugin({ assetNameRegExp: /\.optimize\.css$/g, cssProcessor: require("cssnano"), cssProcessorOptions: { discardComments: { removeAll: true } }, canPrint: true }) ], devServer: { static: { directory: distPath}, port: 5000, compress: true, open: true } }; };