Skip to content

Commit

Permalink
feat(pv-scripts): add support for webpack build caching
Browse files Browse the repository at this point in the history
this allows for much faster `pv-scripts  dev` start when the code hasn't been canged since the last
time
  • Loading branch information
mbehzad committed Apr 25, 2024
1 parent 13abc3f commit 92da961
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/pv-scripts/helpers/webpackConfigHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ const getCustomWebpackConfig = (configName) => {
});
};

function getBuildDependencies() {
return [
"./pv.config.js",
"./webpack.config.js",
"./webpack.config.dev.js",
"./.browserslistrc",
"./.babelrc.json",
"./postcss.config.js",
]
.map((configFile) => resolveApp(configFile))
.filter((filePath) => existsSync(filePath));
}

module.exports = {
getCustomWebpackConfig,
getBuildDependencies,
};
10 changes: 10 additions & 0 deletions packages/pv-scripts/webpack/dev/settings/basicSettings.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
const {
getBuildDependencies,
} = require("../../../helpers/webpackConfigHelpers");

module.exports = {
mode: "development",
devtool: "source-map",
infrastructureLogging: {
level: "none",
},
stats: "errors-only",
cache: {
type: "filesystem",
buildDependencies: {
config: getBuildDependencies(),
},
},
};

0 comments on commit 92da961

Please sign in to comment.