1 Star 0 Fork 0

EricZSP / joyconn-dialog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
eric 提交于 2022-04-24 15:18 . 1.1.32
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: 'production',
entry: ['./index.js'],
output: {
path: path.resolve(__dirname, '.'),
filename: './dist/JoyDialog.js',
// library: 'MA',
// libraryTarget: 'umd'
},
module: {
rules: [
{
//匹配哪些文件
test: /\.css$/,
//使用哪些loader进行处理
use:[
MiniCssExtractPlugin.loader,
'css-loader',
]
},
{
test: /(iconfont.svg)|\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]', //[path] 上下文环境路径
publicPath: './iconfont/', //公共路径
outputPath: 'dist/iconfont/', //输出路径
}
}
]
},
{
test: /\.ts$/,
use: ['babel-loader'],
exclude: [path.resolve(__dirname, 'node_modules')]
},
{
test:/\.md$/,
loader:'vue-markdown-loader',
// options:vueMarkdown,
},
]
},
resolve: {
extensions: ['.js', '.css', '.json'],
},
devServer:{
port:8088,
// host:'0.0.0.0',
// contentBase: path.join(__dirname, "src/demo/demo.html"),
},
plugins: [
new MiniCssExtractPlugin({
filename: 'dist/JoyDialog.css',
}),
// new ExtractTextPlugin({ filename: 'dist/JoyDialog.css', allChunks: false })
// , new HtmlWebpackPlugin({
// template: 'src/demo/demo.html', // 输入文件
// filename: 'src/demo/demo.html', // 输出文件
// })
// ,new BundleAnalyzerPlugin({ analyzerPort: 8919 }) // 预览打包后的文件大小组成
],
optimization: {
minimize: true, // 可省略,默认最优配置:生产环境,压缩 true。开发环境,不压缩 false
minimizer: [
new TerserPlugin() ,
new CssMinimizerPlugin(),
]
},
devtool: 'cheap-module-source-map',
};
1
https://gitee.com/EricZsp/joyconn-dialog.git
git@gitee.com:EricZsp/joyconn-dialog.git
EricZsp
joyconn-dialog
joyconn-dialog
master

搜索帮助