mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 19:26:09 +01:00
enable babel-loader cache (#10083)
this speeds up repeated webpack builds by around 20%. It will use the default cache directory `node_modules/.cache/babel-loader`. Also added cache invalidation to workaround https://github.com/babel/babel-loader/issues/690
This commit is contained in:
parent
3ccd271081
commit
6dcf110628
2
Makefile
2
Makefile
|
@ -509,7 +509,7 @@ $(FOMANTIC_DEST_DIR): semantic.json web_src/fomantic/theme.config.less | node_mo
|
||||||
.PHONY: webpack
|
.PHONY: webpack
|
||||||
webpack: node-check $(WEBPACK_DEST)
|
webpack: node-check $(WEBPACK_DEST)
|
||||||
|
|
||||||
$(WEBPACK_DEST): $(WEBPACK_SOURCES) | node_modules
|
$(WEBPACK_DEST): $(WEBPACK_SOURCES) webpack.config.js | node_modules
|
||||||
npx eslint web_src/js webpack.config.js
|
npx eslint web_src/js webpack.config.js
|
||||||
npx stylelint web_src/less
|
npx stylelint web_src/less
|
||||||
npx webpack --hide-modules --display-entrypoints=false
|
npx webpack --hide-modules --display-entrypoints=false
|
||||||
|
|
|
@ -7,6 +7,7 @@ const PostCSSPresetEnv = require('postcss-preset-env');
|
||||||
const PostCSSSafeParser = require('postcss-safe-parser');
|
const PostCSSSafeParser = require('postcss-safe-parser');
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
||||||
|
const { statSync } = require('fs');
|
||||||
const { resolve, parse } = require('path');
|
const { resolve, parse } = require('path');
|
||||||
const { SourceMapDevToolPlugin } = require('webpack');
|
const { SourceMapDevToolPlugin } = require('webpack');
|
||||||
|
|
||||||
|
@ -84,6 +85,13 @@ module.exports = {
|
||||||
{
|
{
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
|
cacheDirectory: true,
|
||||||
|
cacheCompression: false,
|
||||||
|
cacheIdentifier: [
|
||||||
|
resolve(__dirname, 'package.json'),
|
||||||
|
resolve(__dirname, 'package-lock.json'),
|
||||||
|
resolve(__dirname, 'webpack.config.js'),
|
||||||
|
].map((path) => statSync(path).mtime.getTime()).join(':'),
|
||||||
presets: [
|
presets: [
|
||||||
[
|
[
|
||||||
'@babel/preset-env',
|
'@babel/preset-env',
|
||||||
|
|
Loading…
Reference in a new issue