加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
LiJun 提交于 2022-06-01 02:26 . 1
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { VueLoaderPlugin } = require("vue-loader");
module.exports = {
entry: "./src/main.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].bundle.js",
clean: true,
},
devServer: {
port: 9000,
hot: true,
open: true,
},
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"],
},
{
test: /\.vue$/,
use: "vue-loader",
},
{
test: /\.less$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: "css-loader",
},
{
loader: "less-loader",
},
{
loader: "postcss-loader",
},
],
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: "url-loader",
options: {
limit: 8192,
},
},
],
},
],
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
plugins: [
new HtmlWebpackPlugin({ template: "./public/index.html", inject: "body" }),
new MiniCssExtractPlugin({
filename: "[name][hash:8].css",
}),
new VueLoaderPlugin(),
],
mode: "development",
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化