mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-02 10:50:49 +08:00
65 lines
1.8 KiB
JavaScript
65 lines
1.8 KiB
JavaScript
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');
|
|
const path = require('path');
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
entry: {
|
|
main: './bundle-entry.js'
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: '[name].bundle.js',
|
|
clean: true
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css$/i,
|
|
use: ['style-loader', 'css-loader']
|
|
},
|
|
{
|
|
test: /\.(png|jpg|jpeg|gif|svg)$/i,
|
|
type: 'asset/inline'
|
|
},
|
|
{
|
|
test: /\.html$/i,
|
|
loader: 'html-loader',
|
|
options: {
|
|
sources: {
|
|
list: [
|
|
{
|
|
tag: 'img',
|
|
attribute: 'src',
|
|
type: 'src'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: './index.build.html',
|
|
filename: 'index.html',
|
|
inject: 'body',
|
|
minify: {
|
|
collapseWhitespace: true,
|
|
removeComments: true,
|
|
removeRedundantAttributes: true,
|
|
removeScriptTypeAttributes: true,
|
|
removeStyleLinkTypeAttributes: true,
|
|
useShortDoctype: true
|
|
}
|
|
}),
|
|
new HtmlInlineScriptPlugin({
|
|
htmlMatchPattern: [/index.html$/],
|
|
scriptMatchPattern: [/.js$/]
|
|
})
|
|
],
|
|
optimization: {
|
|
minimize: true
|
|
}
|
|
};
|