Comments (4)
After more tinkering with my perf-test
plugin, I have discovered that if I build the plugin and place it within the node_modules
dir to approximate installing a 3rd party plugin, it loads remarkably fast. (Logs below)
It seems there is something wrong with loading local TS plugins
workspace git:(kb/RN-769-upgrade-to-nx-19) time NX_PERF_LOGGING=true NX_DAEMON=false NX_CACHE_PROJECT_GRAPH=false NX_ISOLATE_PLUGINS=true pnpm nx graph --file=tmp_file3.json --verbose
Time for 'loading dotenv files' 1.1174579999999992
Time for 'workspace context init' 3.954625000000007
Time for 'Load Nx Plugin: /home/vscode/workspace/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/plugins/project-json/build-nodes/package-json-next-to-project-json' 0.44529099999999744
Time for 'Load Nx Plugin: @nx/eslint/plugin' 2.4542920000000095
Time for 'Load Nx Plugin: /home/vscode/workspace/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/plugins/target-defaults/target-defaults-plugin' 2.9343749999999886
Time for 'Load Nx Plugin: /home/vscode/workspace/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/plugins/js' 7.256458000000009
Time for 'Load Nx Plugin: /home/vscode/workspace/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/plugins/package-json-workspaces' 0.47204099999999016
Time for 'Load Nx Plugin: @nx/vite/plugin' 254.830208
Time for 'Load Nx Plugin: @rh-plugins/perf-test' 51.146124999999984
Time for 'Load Nx Plugin: /home/vscode/workspace/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]/node_modules/nx/src/plugins/project-json/build-nodes/project-json' 0.37720899999999347
Time for 'Load Nx Plugin: @nx/storybook/plugin' 213.89875
Time for 'Load Nx Plugin: @nx/remix/plugin' 76.697
Time for 'Load Nx Plugin: @nxlv/python' 194.76016700000002
Time for '@nx/remix/plugin:createNodes' 0.046625000000062755
Time for 'nx/js/dependencies-and-lockfile:createNodes' 40.426874999999995
Time for '@rh-plugins/perf-test:createNodes' 139.61029199999996
Time for 'nx/core/package-json:createNodes' 223.16429199999993
Time for 'nx/core/package-json-workspaces:createNodes' 177.91375000000005
Time for 'nx/core/project-json:createNodes' 176.405125
Time for '@nx/storybook/plugin:createNodes' 321.95854199999997
Time for 'workspace context init' 5.202041000000008
Time for '@nx/vite/plugin:createNodes' 328.05991700000004
Time for 'workspace context init' 10.170041999999967
Time for 'nx/core/target-defaults:createNodes' 341.43791699999997
Time for '@nx/eslint/plugin:createNodes' 1881.7331680000002
Time for 'workspace context init' 5.841625000000022
Time for 'build-project-configs' 1942.886418
Time for 'createNodes:merge' 7.167707999999948
Time for 'native-file-deps' 0.1515409999997246
Time for 'get-workspace-files' 2.2273339999997006
Time for 'get-all-workspace-files' 10.753375000000233
Time for '@nx/storybook/plugin:createDependencies' 98.18079200000011
Time for '@nx/remix/plugin:createDependencies' 84.69016600000032
Time for '@nx/vite/plugin:createDependencies' 62.47445800000014
Time for '@nxlv/python:createDependencies' 239.52779200000032
Time for 'build typescript dependencies' 549.6482080000001
NX JSON output created in /home/vscode/workspace
/home/vscode/workspace/tmp_file3.json
NX_PERF_LOGGING=true NX_DAEMON=false NX_CACHE_PROJECT_GRAPH=false =true pnpm 0.66s user 0.31s system 26% cpu 3.720 total
from nx.
Narrowing it down even further, I added some performance marks in my local nx install, specifically in node_modules/nx/src/plugins/js/utils/typescript.js:readTsConfig
and it looks as though this is where all the time is getting spent on plugin loading, specifically in tsModule.parseJsonConfigFileContent
Time for 'Load Nx Plugin: @rh-plugins/ruff' 62171.26652999999
Time for 'readTsConfig - readConfigFile total' 5.7970000000000255
Time for 'readTsConfig - Total' 61845.963154
So, going out on a wild limb, I tried making a few under-the-hood tweaks and managed to get some pretty significant speed improvements by avoiding the call to tsModule.parseJsonConfigFileContent
altogether; from what I can tell, registerPluginTSTranspiler
doesn't actually need most of the output generated by parseJsonConfigFileContent
, it really just wants the contents of the tsconfig.json
file.
I'll provide a PR that represents what I've found, and hopefully this can get sorted out quickly
from nx.
After investigating the performance of parseJsonConfigFileContent
(mostly by running tsc --showConfig
) I finally diagnosed this as an issue in our tsconfig.base.json
excludes.
I ended up adding some extra excludes, it might be ideal to include some of these in the default which is generated for new workspaces:
"exclude": ["**/node_modules", "**/.*/", "tmp", "**/cdk.out", "dist"]
from nx.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
from nx.
Related Issues (20)
- generatePackageJson should be enabled by default in webpack configuration of @nx/nest applications
- metro web builds cache key collision
- NX Missing Platform Dependency HOT 1
- nx@npm:x.x.x [377db] couldn't be built successfully (exit code 129) HOT 4
- nx report shows @nx and @nrwl together HOT 1
- React Native Image on Android fails to display images loaded with `require()`
- dependency-check lint rule, --fix needs to be run twice
- Reopen Issue #19839: dependentTasksOutputFiles Should Interpolate {projectRoot}
- Dependency Conflict with @nxkit/[email protected] and [email protected] HOT 1
- Invalid /docs URL linked from the "Get started" button on the homepage
- Update Axios for security issues
- @nx/js:tsc --batch not working with dependsOn HOT 1
- Build with generating a `package.json` is missing a GitHub package
- how to achive this in nx?
- how to achive this in nx? __dev__ is undefined
- Compiler option for react library generator not adding SWC plugin import when specified HOT 1
- @nx/webpack doesn't add an inferred build task for all the documented webpack config file types HOT 1
- nx-release-publish fails after upgrading to 19.5.X HOT 1
- The 'implicitDependencies' option in mf does not work. HOT 1
- upgrade @typescript-eslint/parser to v8 for @nx/eslint-plugin HOT 3
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.