1 Star 0 Fork 0

stanhua/ts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
周群华 提交于 2021-06-18 14:29 . ts
const path = require('path')
const webpack = require('webpack')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const nodeExternals = require('webpack-node-externals')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
console.log(nodeExternals())
module.exports = {
mode: 'production',
// entry: {
// index: './src/index.ts',
// abstract: './src/abstract.ts',
// animal: './src/animal.ts'
// },
entry: './src',
output: {
// filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
library: '[name]',
libraryTarget: 'umd'
},
target: 'node',
// externalsPresets: { node: true },
// externals: [nodeExternals()],
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [
{
test: /\.tsx?$/, use: [{
loader: 'tslint-loader',
options: {
configFile: path.resolve(__dirname, 'tslint.json'),
}
}]
},
{
test: /\.tsx?$/, use: [
// { loader: 'babel-loader' }
{
loader: 'ts-loader',
options: {
transpileOnly: true,
configFile: path.resolve(__dirname, 'tsconfig.json'),
},
},
]
}
]
},
optimization: {
minimize: true,
splitChunks: {
cacheGroups: {
commons: {
chunks: 'initial',
minChunks: 2,
maxInitialRequests: 5,
minSize: 0
},
vendor: {
test: /node_modules/,
chunks: 'initial',
name: 'vendor',
priority: 10,
enforce: true
}
}
}
},
plugins: [
new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: ['./dist'] }),
new webpack.ProgressPlugin(),
new ForkTsCheckerWebpackPlugin(),
],
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/stanhua/ts.git
git@gitee.com:stanhua/ts.git
stanhua
ts
ts
master

搜索帮助