| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- const path = require("path");
- const TerserJSPlugin = require('terser-webpack-plugin');
- const HtmlPlugin = require("html-webpack-plugin");
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
- const CleanWebpackPlugin = require("clean-webpack-plugin");
- const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
- const webpack = require("webpack");
- module.exports = {
- plugins: [
- new CleanWebpackPlugin(),
- new HtmlPlugin(
- {
- template: "./ui/masterpage_template.tpl",
- filename: "../../masterpage.tpl",
- }
- ),
- new MiniCssExtractPlugin({filename: "styles.[contenthash].css"}),
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- "window.jQuery": 'jquery'
- })
- ],
- module: {
- rules: [
- {
- // For css...
- test: /\.(css|scss)$/,
- // ...use this loaders
- use: [
- MiniCssExtractPlugin.loader,
- {loader: "css-loader", options: {url: false,}},
- "sass-loader"
- ]
- }
- ]
- },
- optimization: {
- minimizer: [
- new TerserJSPlugin(
- // Discard Comments
- {terserOptions: {output: {comments: false}}, parallel: 4}
- ),
- new OptimizeCSSAssetsPlugin(
- // Discard Comments
- {cssProcessorPluginOptions: {preset: ['default', {discardComments: {removeAll: true}}]}}
- )
- ],
- },
- entry: "./ui/assets/js/index.js",
- output: {
- publicPath: '/omlink/src/openmind/admin/ui/assets/dist/',
- path: path.resolve(__dirname, "ui/assets/dist/"),
- filename: "bundle.[contenthash].js"
- },
- };
|