1 Star 0 Fork 445

pista/Layx

forked from 百小僧/Layx 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
百小僧 提交于 2022-01-04 14:57 . ok
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()
]
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/pista/LayX.git
git@gitee.com:pista/LayX.git
pista
LayX
Layx
dev

搜索帮助