Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

chore(sdk): clean up old sdk files when starting build-hot (#76538)

Nicolò Pretto7ce7ce034f1a
diff --git a/package.json b/package.json
index cc276afd3ec..1e20d7bb083 100644
--- a/package.json
+++ b/package.json
@@ -487,7 +487,7 @@
"ci-frontend": "bun run lint && bun run test",
"clean-cypress-artifacts": "rm -R -f cypress/",
"clean-dev:cljs": "rm -rf target/cljs_dev/*",
- "clean-dev:js": "rm -rf resources/frontend_client/app/dist target/classes/frontend_client/app/dist",
+ "clean-dev:js": "rm -rf resources/frontend_client/app/dist target/classes/frontend_client/app/dist resources/frontend_client/app/embedding-sdk target/classes/frontend_client/app/embedding-sdk",
"clean-release:cljs": "rm -rf target/cljs_release/*",
"clean:cljs": "bun install && bun run clean-dev:cljs && bun run clean-release:cljs",
"cljs-nrepl": "bun install && shadow-cljs node-repl -d cider/cider-nrepl:0.57.0 -d cider/piggieback:0.6.1 -d refactor-nrepl/refactor-nrepl:3.11.0",
diff --git a/rspack.embedding-sdk-bundle.config.js b/rspack.embedding-sdk-bundle.config.js
index 43c5bcd13d3..148401edef0 100644
--- a/rspack.embedding-sdk-bundle.config.js
+++ b/rspack.embedding-sdk-bundle.config.js
@@ -353,6 +353,31 @@ const config = {
);
},
},
+ // Stop `.hot-update` files for the sdk being written to the disk. HMR doesn't work for the SDK bundle anyway
+ {
+ name: "drop-sdk-hot-update-assets",
+ apply(compiler) {
+ compiler.hooks.compilation.tap(
+ "drop-sdk-hot-update-assets",
+ (compilation) => {
+ compilation.hooks.processAssets.tap(
+ {
+ name: "drop-sdk-hot-update-assets",
+ // Run last, after the HMR plugin has emitted the deltas.
+ stage: rspack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
+ },
+ (assets) => {
+ for (const name of Object.keys(assets)) {
+ if (name.includes(".hot-update.")) {
+ compilation.deleteAsset(name);
+ }
+ }
+ },
+ );
+ },
+ );
+ },
+ },
shouldAnalyzeBundles &&
new BundleAnalyzerPlugin({
analyzerMode: "static",