Skip to content

Commit

Permalink
Try to improve performance with thread-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
jovitcorreia committed Aug 19, 2021
1 parent b1b3bae commit 2c0ebb4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Binary file removed assets/fonts/game-icons.eot
Binary file not shown.
Binary file removed assets/fonts/game-icons.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"mini-css-extract-plugin": "^2.2.0",
"postcss": "^8.3.6",
"prettier-standard": "^16.4.1",
"thread-loader": "^3.0.4",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.50.0",
"webpack-cli": "^4.8.0",
Expand Down
4 changes: 0 additions & 4 deletions styles/system/game-icons.less
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
@font-face {
font-family: 'game-icons';
src: url('./assets/fonts/game-icons.woff') format('woff');
// src: url('./assets/fonts/game-icons.eot?#iefix') format('eot'),
// url('./assets/fonts/game-icons.woff') format('woff'),
// url('./assets/fonts/game-icons.ttf') format('truetype'),
// url('../../assets/fonts/game-icons.svg#game-icons') format('svg');
}
.game-icon {
&:before {
Expand Down
17 changes: 13 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path'
import * as process from 'process'
import CopyWebpackPlugin from 'copy-webpack-plugin'
Expand Down Expand Up @@ -55,7 +56,7 @@ const bundleScript = {
bail: buildMode === 'production',
context: __dirname,
entry: './module/coc7.js',
devtool: buildMode === 'development' ? undefined : 'inline-source-map',
devtool: buildMode === 'production' ? undefined : 'inline-source-map',
mode: buildMode,
module: {
rules: [
Expand All @@ -73,12 +74,20 @@ const bundleScript = {
{
loader: 'less-loader',
options: { sourceMap: true }
}
},
]
}
},
{
loader: "thread-loader",
options: {
workers: os.cpus().length + 1,
poolRespawn: false,
poolTimeout: buildMode === 'production' ? 500 : Infinity,
},
},
]
},
optimization,
optimization: optimization,
output: {
clean: true,
path: buildDestination(),
Expand Down

0 comments on commit 2c0ebb4

Please sign in to comment.