代码拉取完成,页面将自动刷新
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(),
],
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。