Merge pull request #3317 from h3poteto/fix/compile-speed

Improve compile speed for ts-loader
This commit is contained in:
AkiraFukushima 2022-05-01 20:39:16 +09:00 committed by GitHub
commit 5d38f209f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 34 deletions

View File

@ -32,3 +32,40 @@ jobs:
- run: - run:
name: compile renderer name: compile renderer
command: yarn run pack:renderer command: yarn run pack:renderer
lint:
docker:
- image: node:16.13.1-buster-slim
working_directory: /var/opt/app
steps:
- checkout
- run:
name: git
command: |
apt-get update
apt-get install -y git
- restore_cache:
name: Restoring cache - node_modules
keys:
- node_modules-{{ arch }}-node16.13.1-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- run:
name: Install packages
command: yarn install
- save_cache:
name: Saving cache - node_modules
key: node_modules-{{ arch }}-node16.13.1-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: typecheck
command: yarn run typecheck
- run:
name: lint
command: yarn run lint
workflows:
version: 2
build_and_deploy:
jobs:
- build
- lint

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"