From b408d5693dd9c52408fec59266d8a57b108116e6 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Tue, 6 Jun 2023 11:08:39 +0300 Subject: [PATCH] chore!: Make linkable-push opt-in for shared build scripts This is because linkable-push is a non-deterministic side-effect, and thus breaks fundamentals of nx-cacheing. Running it elsewhere in later commit will give us best-of-both-worlds, where builds get cached, and linkable-push still gets run automatically when required. BREAKING CHANGE: Add "new LinkablePushPlugin()" in your "plugins" of webpack.config to restore automatic linkable-push when using "lens-webpack-build", "lens-webpack-build --watch" or just "webpack". Co-authored-by: Janne Savolainen Signed-off-by: Mikko Aspiala --- packages/infrastructure/webpack/index.ts | 1 + .../src/__snapshots__/get-multi-export-config.test.ts.snap | 7 ++----- .../webpack/src/__snapshots__/get-node-config.test.ts.snap | 1 - packages/infrastructure/webpack/src/get-node-config.ts | 3 --- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/infrastructure/webpack/index.ts b/packages/infrastructure/webpack/index.ts index 72b6800d02..c5a03166db 100644 --- a/packages/infrastructure/webpack/index.ts +++ b/packages/infrastructure/webpack/index.ts @@ -2,3 +2,4 @@ export { configForNode } from "./src/node-config"; export { configForReact } from "./src/react-config"; export { getMultiExportConfig } from "./src/get-multi-export-config"; export { doWebpackBuild } from "./do-webpack-build"; +export { LinkablePushPlugin } from "./src/plugins/linkable-push-plugin"; diff --git a/packages/infrastructure/webpack/src/__snapshots__/get-multi-export-config.test.ts.snap b/packages/infrastructure/webpack/src/__snapshots__/get-multi-export-config.test.ts.snap index 8caee84951..50c7df816d 100644 --- a/packages/infrastructure/webpack/src/__snapshots__/get-multi-export-config.test.ts.snap +++ b/packages/infrastructure/webpack/src/__snapshots__/get-multi-export-config.test.ts.snap @@ -26,8 +26,7 @@ exports[`get-multi-export-config given maximal package.json, when creating confi } } } - }, - LinkablePushPlugin {} + } ], output: { path: '/some-working-directory/dist', @@ -62,8 +61,7 @@ exports[`get-multi-export-config given maximal package.json, when creating confi } } } - }, - LinkablePushPlugin {} + } ], output: { path: '/some-working-directory/dist/some-entrypoint', @@ -99,7 +97,6 @@ exports[`get-multi-export-config given maximal package.json, when creating confi } } }, - LinkablePushPlugin {}, MiniCssExtractPlugin { _sortedModulesCache: WeakMap { }, options: { diff --git a/packages/infrastructure/webpack/src/__snapshots__/get-node-config.test.ts.snap b/packages/infrastructure/webpack/src/__snapshots__/get-node-config.test.ts.snap index 294cfc1e36..aab5044f99 100644 --- a/packages/infrastructure/webpack/src/__snapshots__/get-node-config.test.ts.snap +++ b/packages/infrastructure/webpack/src/__snapshots__/get-node-config.test.ts.snap @@ -53,7 +53,6 @@ exports[`get-node-config given an environment, works 1`] = ` }, }, }, - LinkablePushPlugin {}, ], "resolve": { "extensions": [ diff --git a/packages/infrastructure/webpack/src/get-node-config.ts b/packages/infrastructure/webpack/src/get-node-config.ts index 08c2820641..d96bb3cce2 100644 --- a/packages/infrastructure/webpack/src/get-node-config.ts +++ b/packages/infrastructure/webpack/src/get-node-config.ts @@ -2,7 +2,6 @@ import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"; import type { Configuration } from "webpack"; import { MakePeerDependenciesExternalPlugin } from "./plugins/make-peer-dependencies-external"; import { ProtectFromImportingNonDependencies } from "./plugins/protect-from-importing-non-dependencies"; -import { LinkablePushPlugin } from "./plugins/linkable-push-plugin"; import type { Environment } from "./runtime-values/environment"; export type GetNodeConfigParams = { @@ -49,8 +48,6 @@ export const getNodeConfig = ({ }, }, }), - - new LinkablePushPlugin(), ], output: {