perf: revert babel/ts thread behavior

This commit is contained in:
Evan You
2018-05-22 13:25:35 -04:00
parent 7fd5f255e0
commit e5101b415e
4 changed files with 21 additions and 0 deletions

View File

@@ -22,6 +22,10 @@ module.exports = {
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/babel-loader`.
## Parallelization
[thread-loader](https://github.com/webpack-contrib/thread-loader) is enabled by default when the machine has more than 1 CPU cores. This can be turned off by setting `parallel: false` in `vue.config.js`.
## Installing in an Already Created Project
``` sh

View File

@@ -1,5 +1,6 @@
module.exports = (api, options) => {
const { genCacheConfig } = require('@vue/cli-shared-utils')
const useThreads = process.env.NODE_ENV === 'production' && options.parallel
const cliServicePath = require('path').dirname(require.resolve('@vue/cli-service'))
api.chainWebpack(webpackConfig => {
@@ -29,6 +30,12 @@ module.exports = (api, options) => {
.options(genCacheConfig(api, options, 'babel-loader', 'babel.config.js'))
.end()
if (useThreads) {
jsRule
.use('thread-loader')
.loader('thread-loader')
}
jsRule
.use('babel-loader')
.loader('babel-loader')

View File

@@ -18,6 +18,10 @@ If opted to use [TSLint](https://palantir.github.io/tslint/) during project crea
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/ts-loader`.
## Parallelization
[thread-loader](https://github.com/webpack-contrib/thread-loader) is enabled by default when the machine has more than 1 CPU cores. This can be turned off by setting `parallel: false` in `vue.config.js`.
## Installing in an Already Created Project
``` sh

View File

@@ -26,6 +26,12 @@ module.exports = (api, options) => {
options: genCacheConfig(api, options, 'ts-loader', 'tsconfig.json')
})
if (useThreads) {
addLoader({
loader: 'thread-loader'
})
}
if (api.hasPlugin('babel')) {
addLoader({
loader: 'babel-loader'