1 Star 0 Fork 0

kevin/webui-aria2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
Pratik Borsadiya 提交于 2018-09-07 19:28 . Rename Build directory to docs
const path = require("path");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const WorkboxPlugin = require("workbox-webpack-plugin");
const BUILD_DIR = path.join(__dirname, "docs");
const APP_DIR = path.join(__dirname, "src", "js");
const config = {
entry: {
app: APP_DIR + "/app.js"
},
module: {
rules: [
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader", "sass-loader"]
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"]
},
{
test: /\.svg$/,
use: [
{
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: "flags/"
}
}
]
}
]
},
output: {
path: BUILD_DIR,
filename: "[name].js"
},
plugins: [
new CleanWebpackPlugin(["docs"]),
new webpack.ProvidePlugin({
"window.jQuery": "jquery",
jQuery: "jquery",
$: "jquery"
}),
new HtmlWebpackPlugin({
template: "src/index-template.html",
inject: "head"
}),
new MiniCssExtractPlugin({
filename: "[name].css"
}),
new WorkboxPlugin.GenerateSW()
],
optimization: {
splitChunks: {
cacheGroups: {
commons: { test: /[\\/]node_modules[\\/]/, name: "vendor", chunks: "all" }
}
}
},
resolve: {
modules: [
path.resolve("./"),
path.resolve("./node_modules"),
path.resolve("./src/js"),
path.resolve("./src/scss")
]
}
};
module.exports = config;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huangxin1999/webui-aria2.git
git@gitee.com:huangxin1999/webui-aria2.git
huangxin1999
webui-aria2
webui-aria2
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385