Improve compile speed for ts-loader

This commit is contained in:
AkiraFukushima 2022-05-01 18:02:47 +09:00
parent a0ba665116
commit 5c975d515e
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
3 changed files with 10 additions and 34 deletions

View File

@ -16,17 +16,6 @@ let mainConfig = {
externals: [...Object.keys(dependencies || {})], externals: [...Object.keys(dependencies || {})],
module: { module: {
rules: [ rules: [
{
test: /\.(js|ts)$/,
enforce: 'pre',
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
formatter: require('eslint-friendly-formatter')
}
}
},
{ {
test: /\.ts$/, test: /\.ts$/,
exclude: /node_modules/, exclude: /node_modules/,

View File

@ -17,30 +17,14 @@ let rendererConfig = {
}, },
module: { module: {
rules: [ rules: [
{
test: /\.(js|vue|ts)$/,
enforce: 'pre',
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
formatter: require('eslint-friendly-formatter')
}
}
},
{ {
test: /\.vue$/, test: /\.vue$/,
use: { use: {
loader: 'vue-loader', loader: 'vue-loader',
options: { options: {
extractCSS: process.env.NODE_ENV === 'production', extractCSS: process.env.NODE_ENV === 'production',
loaders: { esModule: true,
js: 'ts-loader', optimizeSSR: false
ts: 'ts-loader',
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
scss: 'vue-style-loader!css-loader!sass-loader',
less: 'vue-style-loader!css-loader!less-loader'
}
} }
} }
}, },
@ -109,19 +93,20 @@ let rendererConfig = {
exclude: /node_modules/, exclude: /node_modules/,
use: [ use: [
{ {
loader: 'babel-loader' loader: 'babel-loader?cacheDirectory'
}, },
{ {
loader: 'ts-loader', loader: 'ts-loader',
options: { options: {
appendTsSuffixTo: [/\.vue$/] appendTsSuffixTo: [/\.vue$/],
transpileOnly: true
} }
} }
] ]
}, },
{ {
test: /\.js$/, test: /\.js$/,
use: 'babel-loader', use: 'babel-loader?cacheDirectory',
exclude: /node_modules/ exclude: /node_modules/
}, },
{ {

View File

@ -21,6 +21,8 @@
"main": "./dist/electron/main.js", "main": "./dist/electron/main.js",
"scripts": { "scripts": {
"dev": "node .electron-vue/dev-runner.js", "dev": "node .electron-vue/dev-runner.js",
"dev:main": "webpack --node-env=development --mode development --progress --config .electron-vue/webpack.main.config.js",
"dev:renderer": "webpack --node-env=development --mode development --progress --config .electron-vue/webpack.renderer.config.js",
"lint": "eslint --ext .js,.vue,.ts -f ./node_modules/eslint-friendly-formatter src spec", "lint": "eslint --ext .js,.vue,.ts -f ./node_modules/eslint-friendly-formatter src spec",
"lint:fix": "eslint --ext .js,.vue,.ts -f ./node_modules/eslint-friendly-formatter --fix src spec", "lint:fix": "eslint --ext .js,.vue,.ts -f ./node_modules/eslint-friendly-formatter --fix src spec",
"stylelint": "stylelint '**/*.vue'", "stylelint": "stylelint '**/*.vue'",
@ -36,7 +38,7 @@
"pack": "yarn run pack:main && yarn run pack:renderer", "pack": "yarn run pack:main && yarn run pack:renderer",
"pack:main": "webpack --node-env=production --mode production --progress --config .electron-vue/webpack.main.config.js", "pack:main": "webpack --node-env=production --mode production --progress --config .electron-vue/webpack.main.config.js",
"pack:renderer": "webpack --node-env=production --mode production --progress --config .electron-vue/webpack.renderer.config.js", "pack:renderer": "webpack --node-env=production --mode production --progress --config .electron-vue/webpack.renderer.config.js",
"postinstall": "yarn run lint:fix", "typecheck": "tsc -p . --noEmit",
"spec": "NODE_ENV=test jest -u --maxWorkers=3" "spec": "NODE_ENV=test jest -u --maxWorkers=3"
}, },
"jest": { "jest": {
@ -73,7 +75,6 @@
"@fortawesome/free-regular-svg-icons": "^6.1.0", "@fortawesome/free-regular-svg-icons": "^6.1.0",
"@fortawesome/free-solid-svg-icons": "^6.1.0", "@fortawesome/free-solid-svg-icons": "^6.1.0",
"@fortawesome/vue-fontawesome": "^3.0.0-5", "@fortawesome/vue-fontawesome": "^3.0.0-5",
"vue-virtual-scroller": "2.0.0-alpha.1",
"@trodi/electron-splashscreen": "^1.0.2", "@trodi/electron-splashscreen": "^1.0.2",
"about-window": "^1.15.2", "about-window": "^1.15.2",
"animate.css": "^4.1.0", "animate.css": "^4.1.0",
@ -108,6 +109,7 @@
"vue-popperjs": "^2.3.0", "vue-popperjs": "^2.3.0",
"vue-resize": "^2.0.0-alpha.1", "vue-resize": "^2.0.0-alpha.1",
"vue-router": "^4.0.14", "vue-router": "^4.0.14",
"vue-virtual-scroller": "2.0.0-alpha.1",
"vue3-i18next": "^0.2.0", "vue3-i18next": "^0.2.0",
"vuex": "^4.0.2", "vuex": "^4.0.2",
"vuex-router-sync": "^6.0.0-rc.1" "vuex-router-sync": "^6.0.0-rc.1"