mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-12 20:19:55 -05:00
perf: revert babel/ts thread behavior
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user