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:
name: compile 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 || {})],
module: {
rules: [
{
test: /\.(js|ts)$/,
enforce: 'pre',
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
formatter: require('eslint-friendly-formatter')
}
}
},
{
test: /\.ts$/,
exclude: /node_modules/,

View File

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

View File

@ -21,6 +21,8 @@
"main": "./dist/electron/main.js",
"scripts": {
"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:fix": "eslint --ext .js,.vue,.ts -f ./node_modules/eslint-friendly-formatter --fix src spec",
"stylelint": "stylelint '**/*.vue'",
@ -36,7 +38,7 @@
"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: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"
},
"jest": {
@ -73,7 +75,6 @@
"@fortawesome/free-regular-svg-icons": "^6.1.0",
"@fortawesome/free-solid-svg-icons": "^6.1.0",
"@fortawesome/vue-fontawesome": "^3.0.0-5",
"vue-virtual-scroller": "2.0.0-alpha.1",
"@trodi/electron-splashscreen": "^1.0.2",
"about-window": "^1.15.2",
"animate.css": "^4.1.0",
@ -108,6 +109,7 @@
"vue-popperjs": "^2.3.0",
"vue-resize": "^2.0.0-alpha.1",
"vue-router": "^4.0.14",
"vue-virtual-scroller": "2.0.0-alpha.1",
"vue3-i18next": "^0.2.0",
"vuex": "^4.0.2",
"vuex-router-sync": "^6.0.0-rc.1"