diff --git a/app/index.html b/app/index.html index 28af3b65c..061c48cc4 100644 --- a/app/index.html +++ b/app/index.html @@ -18,10 +18,9 @@ - - - + + diff --git a/webpack.config.js b/webpack.config.js index c598c6139..6765c737d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,13 +3,13 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const WebpackBuildNotifierPlugin = require('webpack-build-notifier'); const CleanTerminalPlugin = require('clean-terminal-webpack-plugin'); const { ProvidePlugin } = require('webpack'); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const CleanWebpackPlugin = require('clean-webpack-plugin'); const npmPackage = require('./package.json'); module.exports = { entry: { - vendors: './app/vendors.js', - main: './app/__module.js', + main: './app/__module.js' }, output: { filename: '[name].[hash].js', @@ -37,17 +37,29 @@ module.exports = { ] }, { - test: /\.(woff|woff2|eot|ttf|svg)$/, - loader: 'url-loader?limit=100000' - }, - { - test: /\.(png|jpg|gif)$/, + test: /\.(woff|woff2|eot|ttf|svg|)$/, use: [ { - loader: 'file-loader' + loader: 'url-loader', + options: { limit: 25000 } } ] }, + { + test: /\.(ico|png|jpg|gif)$/, + use: [ + { + loader: 'url-loader', + options: { + limit: 25000 + } + } + ] + }, + { + test: /.xml$/, + use: 'file-loader' + }, { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader?sourceMap'] @@ -61,10 +73,11 @@ module.exports = { templateParameters: { name: npmPackage.name, author: npmPackage.author - } + }, + manifest: './assets/ico/manifest.json' }), new WebpackBuildNotifierPlugin({ - title: 'My Project Webpack Build', + title: 'Portainer build', logo: path.resolve('./assets/favicon-32x32.png'), suppressSuccess: true }), @@ -73,13 +86,27 @@ module.exports = { $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery' - // angular: 'angular' }), new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional - filename: "[name].css", - chunkFilename: "[id].css" - }) - ] + filename: '[name].css', + chunkFilename: '[id].css', + sourceMap: true + }), + new CleanWebpackPlugin(['dist/public']) + ], + optimization: { + splitChunks: { + cacheGroups: { + vendor: { + test: /node_modules/, + chunks: 'initial', + name: 'vendor', + priority: 10, + enforce: true + } + } + } + } };