1 Star 0 Fork 1

MyCoCo/李立超TS

forked from codexyuue/李立超TS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
codexyuue 提交于 2021-08-04 09:41 +08:00 . 比较完整的webpack配置
// 引入一个包
const path = require('path')
// 引入html插件
const HTMLWebpackPlugin = require('html-webpack-plugin')
// 引入clean插件,每次打包都会清除之前的包
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
// 所有的配置都写在module.export中
module.exports = {
entry: "./src/index.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
// 告诉webpack不使用箭头函数
environment: {
arrowFunction: false
}
},
module: {
// 指定要加载的规则
rules: [
{
// test指定规则生效的文件
test: /\.ts$/,
// 要使用的loader
use: [
// 配置babel
{
// 指定加载器
loader: "babel-loader",
// 设置babel
options: {
// 设置预定义的环境
presets: [
[
// 指定环境的插件
"@babel/preset-env",
// 配置信息
{
// 要兼容的目标浏览器
targets: {
"chrome": "58",
"ie": "11"
},
// 指定corejs的版本
"corejs": "3",
// 使用corejs的方式
"useBuiltIns": "usage"
}
]
]
}
},
{
loader: "ts-loader"
}
],
// 要排除的文件
exclude: /node_modules/
}
]
},
plugins: [
new CleanWebpackPlugin(),
new HTMLWebpackPlugin({
// title: "贪吃蛇"
template: "./src/index.html"
}),
],
// 用来设置引用模块
resolve: {
extensions: [".ts", ".js"]
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wujiezone/li-lichao-ts.git
git@gitee.com:wujiezone/li-lichao-ts.git
wujiezone
li-lichao-ts
李立超TS
master

搜索帮助