Add webpack config for analyzing builds and improve ts speed
This commit is contained in:
parent
46f9a0fc8a
commit
5cb181f68c
4 changed files with 937 additions and 14 deletions
|
@ -1,6 +1,7 @@
|
|||
const path = require('path');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const { DefinePlugin } = require('webpack');
|
||||
|
@ -100,6 +101,11 @@ const config = {
|
|||
to: path.resolve(__dirname, './dist')
|
||||
};
|
||||
})
|
||||
}),
|
||||
new ForkTsCheckerWebpackPlugin({
|
||||
typescript: {
|
||||
configFile: path.resolve(__dirname, 'tsconfig.json')
|
||||
}
|
||||
})
|
||||
],
|
||||
output: {
|
||||
|
@ -110,6 +116,8 @@ const config = {
|
|||
},
|
||||
optimization: {
|
||||
runtimeChunk: 'single',
|
||||
removeAvailableModules: false,
|
||||
removeEmptyChunks: false,
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
maxInitialRequests: Infinity,
|
||||
|
@ -216,14 +224,22 @@ const config = {
|
|||
exclude: /node_modules/,
|
||||
use: [
|
||||
'worker-loader',
|
||||
'ts-loader'
|
||||
{
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(ts|tsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: [{
|
||||
loader: 'ts-loader'
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
/* modules that Babel breaks when transforming to ESM */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue