1 Star 0 Fork 342

zhoutk / 魔方栈

forked from 华哲辰 / 魔方栈 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
华哲辰 提交于 2021-07-19 22:50 . webpack config eslint disable
/* eslint-disable */
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = (env, argv) => ({
entry: {
index: "./src/index.ts",
},
devtool: argv.mode === "production" ? false : "eval-cheap-module-source-map",
output: {
path: path.resolve(__dirname, "./dist"),
filename: "[name].[chunkhash].js",
globalObject: "this",
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.tsx?$/,
loader: "ts-loader",
},
{
test: /\.(html|svg)?$/,
loader: "text-loader",
},
{
test: /.(png|woff(2)?|eot|ttf)(\?[a-z0-9=\.]+)?$/,
type: "asset/inline",
},
],
},
resolve: {
alias: {
vue$: "vue/dist/vue.esm.js",
},
extensions: ["*", ".js", ".ts", ".json"],
},
performance: {
hints: false,
},
optimization: {
minimize: argv.mode === "production",
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
parallel: true,
}),
],
splitChunks: {
chunks: "initial",
name: "vendor",
},
},
plugins: [
new HtmlWebpackPlugin({
favicon: "./resource/icon.png",
filename: "index.html",
template: "./resource/index.html",
}),
new CleanWebpackPlugin({
dry: argv.mode !== "production",
}),
],
});
TypeScript
1
https://gitee.com/zhoutk/cuber.git
git@gitee.com:zhoutk/cuber.git
zhoutk
cuber
魔方栈
master

搜索帮助