Comments (3)
Nice find! 💯
The monkey patch is slightly off, in the sense that loadedPlugins
is assigned after an await
point. Consequently plugins may still load multiple times when there's multiple calls before the promise has resolved.
I'd suggest something like
let loadedPlugins: Promise<LoadedNxPlugin[]>;
let cleanup: () => void;
export async function getPlugins() {
return loadedPlugins ??= getPluginsWorker();
}
async function getPluginsWorker() {
const pluginsConfiguration = readNxJson().plugins ?? [];
const [result, cleanupFn] = await loadNxPlugins(
pluginsConfiguration,
workspaceRoot
);
cleanup = cleanupFn;
return result;
}
That still leaves a race condition w.r.t. cleanupPlugins
, which ideally becomes async
as well to be able to wait any pending loadNxPlugins
(otherwise the cleanup
function is set after cleanup has already been invoked). Additionally, cleanup
should probably be cleared once invoked to avoid any potential for memory leaks.
from nx.
NOTE: I'm working on the assumption that we've done the right thing in our monkey-patch, if that isn't the case I'm happy to try and put together a more trivial reproduction than our monorepo.
from nx.
I can confirm this bug with upgrade from 17.3 to > 18. I can also confirm that the mentioned monkey patch solves the problem for us
from nx.
Related Issues (20)
- Issue when creating backend app in node for a NX monorepo HOT 1
- nx fails to create a workspace HOT 3
- NX_TASK_TARGET_PROJECT is not exposed in NX 19 HOT 8
- updateDependents feature is not working as expected. HOT 28
- Failed DTE tasks in Agents not replayed on the main job HOT 5
- Nx loading in multiple instances of packages and the shared function in webpack.config.js does nothing HOT 3
- NX React 10kb inline limit customizable? HOT 1
- [Rollup] Update prettier version to 3
- v19.1.0 nx fails if bun.lockb is present HOT 23
- Angular - Compat matrix HOT 2
- Can't install after generating @nx/remix app due to conflicting peer dependency for vite HOT 2
- Storybook run command terminates right after it successfully ran message HOT 4
- Can't open nx console generator ui since upgrade @nx/angular to 19.1 and angular 18 HOT 3
- Unable to combine Expo and React applications in the same workspace HOT 4
- Problem with TS config and auto import when generating a new Nx workspace with @nx/nuxt HOT 2
- @AgentEnder Your fix broke `skipRemotes` entirely. It finds matching projects based on the `projectGraph`. If the projects are in a different repository and are not running (which is my use-case and is also other's use-case as well I'm sure), it won't be able to find them. Then `remotesToSkip` ends up being empty causing an error when you start the project. HOT 1
- NX failed on migrate angular monorepo init --integrated HOT 4
- Playwright documentation link not found
- @nx/vite:build includes package.json in the build output HOT 4
- @nx/nest publishable lib generator adds dependencies to root package.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nx.