Enabled persistent caching for Webpack.
This commit is contained in:
parent
4de4e8dfa1
commit
c7bc6ca8fa
@ -4,7 +4,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --config webpack.common.js",
|
"build": "webpack --config webpack.common.js",
|
||||||
"build:dev": "webpack --config webpack.dev.js",
|
"build:dev": "webpack --config webpack.dev.js",
|
||||||
"build:prod": "webpack --config webpack.prod.js"
|
"build:prod": "webpack --config webpack.prod.js",
|
||||||
|
"postinstall": "py ../scripts/npm_post_install.py"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
@ -14,6 +14,12 @@ let config = {
|
|||||||
providedExports: false,
|
providedExports: false,
|
||||||
splitChunks: false,
|
splitChunks: false,
|
||||||
innerGraph: false,
|
innerGraph: false,
|
||||||
|
},
|
||||||
|
cache: {
|
||||||
|
type: "filesystem",
|
||||||
|
buildDependencies: {
|
||||||
|
config: [__filename],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
14
scripts/clear_webpack_cache.py
Normal file
14
scripts/clear_webpack_cache.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
CACHE_DIR = "./Props/node_modules/.cache/webpack"
|
||||||
|
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
os.chdir("..")
|
||||||
|
shutil.rmtree(CACHE_DIR, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "main":
|
||||||
|
clear()
|
3
scripts/npm_post_install.py
Normal file
3
scripts/npm_post_install.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import clear_webpack_cache
|
||||||
|
|
||||||
|
clear_webpack_cache.clear() # Refer to https://webpack.js.org/guides/build-performance/#persistent-cache and https://webpack.js.org/blog/2020-10-10-webpack-5-release/#persistent-caching
|
Loading…
Reference in New Issue
Block a user