1 Star 1 Fork 0

Forget Corner/muyunyou_refactoring

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 2.00 KB
一键复制 编辑 原始数据 按行查看 历史
Forget Corner 提交于 2024-10-18 15:34 . 删除空格
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const resolve = data => path.resolve(__dirname, data);
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
resolve: {
// 路径别名
alias: {
api: resolve('src/api'),
components: resolve('src/components'),
pages: resolve('src/pages'),
fonts: resolve('src/assets/fonts'),
images: resolve('src/assets/images'),
styles: resolve('src/assets/styles'),
},
},
entry: './src/pages/index/index.js',
output: {
path: resolve('dist'),
filename: 'index.js',
// 静态资源模块文件名
assetModuleFilename: 'assets/[name][ext][query]',
// 打包的时候打开,清除dist目录,开发环境下注释掉,会报错
// clean:true
},
module: {
rules: [
{
test: /\.art$/i,
loader: 'art-template-loader'
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader']
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset',
// 控制图片是否转化为base64编码格式
parser: {
dataUrlCondition: {
maxSize: 4 * 1024 // 4kb,默认值是8kb
}
}
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 4 * 1024 // 4kb,默认值是8kb
}
}
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'style.css'
}),
new HtmlWebpackPlugin({
template: './src/pages/index/index.art',
filename: 'index.html',
minify: {
// 删除 index.html 中的注释
removeComments: true,
// 删除 index.html 中的空格
collapseWhitespace: true,
// 删除各种 html 标签属性值的双引号
removeAttributeQuotes: true
}
})
]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kamusari/muyunyou_refactoring.git
git@gitee.com:kamusari/muyunyou_refactoring.git
kamusari
muyunyou_refactoring
muyunyou_refactoring
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385