| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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/frontend/errors_template.tpl",
- filename: path.resolve(__dirname, './ui/frontend/errors.tpl'),
- }
- ),
- new HtmlPlugin(
- {
- template: "./ui/frontend/masterpage_template.tpl",
- filename: path.resolve(__dirname, './ui/frontend/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,
- "css-loader",
- "sass-loader"
- ]
- },
- // Import various assets
- {test: /\.(jpg|png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000'}
- ]
- },
- optimization: {
- minimizer: [
- new TerserJSPlugin(
- // Discard Comments
- {terserOptions: {output: {comments: false}}, parallel: 4}
- ),
- new OptimizeCSSAssetsPlugin(
- // Discard Comments
- {cssProcessorPluginOptions: {preset: ['default', {discardComments: {removeAll: true}}]}}
- )
- ],
- },
- entry: "./ui/frontend/js/index.js",
- output: {
- publicPath: '/omlink/assets/frontend/',
- path: path.resolve(__dirname, "assets/frontend/"),
- filename: "bundle.[contenthash].js"
- },
- };
|