2 Star 0 Fork 0

lh66 / elementUI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
lh66 提交于 2024-01-25 14:53 . add
const path = require('path')
const webpack = require("webpack")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
module.exports = {
//入口配置文件
entry: {
entry: "./src/main.js"
},
//出口文件的配置项
output: {
path: path.resolve(__dirname, "dist"), //输出的路径,用了Node语法
filename: "js/[name]-[hash:8].bundle.js" //输出的文件名称
},
//模块:例如解读CSS,图片如何转换,压缩
module: {
rules: [{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(eot|woff2?|ttf|svg)$/,
use: [{
loader: "url-loader",
options: {
name: "[name]-[hash:8].min.[ext]",
limit: 5000, // fonts file size <= 5KB, use 'base64'; else, output svg file
publicPath: "fonts/",
outputPath: "fonts/"
}
}]
},
{
test: /\.vue$/,
use: [{
loader: 'vue-loader',
options: {
preserveWhitespace: false // 不要留空白
}
}],
include: [path.resolve(__dirname, 'src')]
},
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: "babel-loader"// 转化需要的loader
}
},
{
test: /\.(png|jpg|jpeg|gif)$/,
use: [{
loader: "url-loader",
options: {
name: "[name]-[hash:8].min.[ext]",
limit: 8 * 1024, // size <= 8KB
outputPath: './img',
publicPath: './img',
esModule: false
}
}]
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.json']
},
mode: "development",
//插件,用于生产模版和各项功能
devServer: {
// ...
stats: "errors-only",
},
stats: "errors-only",
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: path.join(__dirname, "./public/index.html"),
chunks: ["entry"]
}),
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new CleanWebpackPlugin(), // 所要清理的文件夹名称
new FriendlyErrorsWebpackPlugin(),//打印日志
],
}
1
https://gitee.com/lh66/element-ui.git
git@gitee.com:lh66/element-ui.git
lh66
element-ui
elementUI
master

搜索帮助