diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-05-22 17:06:34 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-05-22 17:06:34 -0500 |
commit | 7774b318f83558298280737a0602ebfddd862211 (patch) | |
tree | e89f55582a0855079c2ab51ff3c2f7f7f974839b /config/webpack.config.js | |
parent | 76e276cb433a7023cf8154f9d9555725b3b11e67 (diff) | |
download | gitlab-ce-7774b318f83558298280737a0602ebfddd862211.tar.gz |
add file cache to vue-loader to speed up compilation46603-add-vue-loader-cache
Diffstat (limited to 'config/webpack.config.js')
-rw-r--r-- | config/webpack.config.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index cfeae801e7b..27050e7069d 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -9,6 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const ROOT_PATH = path.resolve(__dirname, '..'); +const CACHE_PATH = path.join(ROOT_PATH, 'tmp/cache'); const IS_PRODUCTION = process.env.NODE_ENV === 'production'; const IS_DEV_SERVER = process.argv.join(' ').indexOf('webpack-dev-server') !== -1; const DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost'; @@ -17,6 +18,9 @@ const DEV_SERVER_LIVERELOAD = IS_DEV_SERVER && process.env.DEV_SERVER_LIVERELOAD const WEBPACK_REPORT = process.env.WEBPACK_REPORT; const NO_COMPRESSION = process.env.NO_COMPRESSION; +const VUE_VERSION = require('vue/package.json').version; +const VUE_LOADER_VERSION = require('vue-loader/package.json').version; + let autoEntriesCount = 0; let watchAutoEntries = []; const defaultEntries = ['./main']; @@ -99,12 +103,21 @@ module.exports = { exclude: path => /node_modules|vendor[\\/]assets/.test(path) && !/\.vue\.js/.test(path), loader: 'babel-loader', options: { - cacheDirectory: path.join(ROOT_PATH, 'tmp/cache/babel-loader'), + cacheDirectory: path.join(CACHE_PATH, 'babel-loader'), }, }, { test: /\.vue$/, loader: 'vue-loader', + options: { + cacheDirectory: path.join(CACHE_PATH, 'vue-loader'), + cacheIdentifier: [ + process.env.NODE_ENV || 'development', + webpack.version, + VUE_VERSION, + VUE_LOADER_VERSION, + ].join('|'), + }, }, { test: /\.svg$/, |