代码拉取完成,页面将自动刷新
const HtmlWebPackPlugin = require("html-webpack-plugin");
const UglifyJsWebpackPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCssAssetsWebPackPlugin = require("optimize-css-assets-webpack-plugin");
const MiniCssExtractWebpackPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: "development",
entry: "./src/index.ts",
output: {
filename: "layx.min.js",
path: __dirname + "/dist",
libraryTarget: "umd",
library: "layx",
libraryExport: "default"
},
module: {
rules: [
{
test: /\.css$/, use: [
MiniCssExtractWebpackPlugin.loader,
{
loader: "css-loader",
options: {
importLoaders: 1
}
},
"postcss-loader"
]
},
{
test: /\.svg$/,
loader: 'svg-sprite-loader',
options: {
}
},
{
test: /\.ts?$/,
use: "ts-loader"
}
]
},
resolve: {
extensions: [
".ts",
".tsx",
".js"
]
},
plugins: [
new MiniCssExtractWebpackPlugin({
filename: "layx.min.css"
}),
new OptimizeCssAssetsWebPackPlugin({
assetNameRegExp: /\.style\.css$/g,
cssProcessor: require("cssnano"),
cssProcessorOptions: {
preset: [
"default",
{
discardComments: {
removeAll: true
},
normalizeUnicode: false
}
]
},
canPrint: true
}),
new HtmlWebPackPlugin({
title: "A magical window. - Layx",
template: "./template.html",
inject: "head",
hash: true
})
],
optimization: {
minimizer: [
new UglifyJsWebpackPlugin(),
new OptimizeCssAssetsWebPackPlugin()
]
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。