Closed rtrembecky closed 1 month ago
Could you provide your tsconfig.base.json
setup? As well as your nx report
? Thanks :)
of course, this is our tsconfig.base.json
:
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"moduleResolution": "node",
"target": "es2015",
"module": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"baseUrl": ".",
"paths": {
"@next-pwa-app/api/data-sources": ["libs/api/data-sources/src/index.ts"],
"@next-pwa-app/api/deal-feed": ["libs/api/deal-feed/src/index.ts"],
"@next-pwa-app/api/model": ["libs/api/model/src/index.ts"],
"@next-pwa-app/core": ["libs/core/src/index.ts"],
"@next-pwa-app/core/*": ["libs/core/src/*"],
"@next-pwa-app/generators": ["libs/generators/src/index.ts"],
"@next-pwa-app/gql-server/*": ["libs/gql-server/src/*"],
"@next-pwa-app/mobile/addresses": ["libs/mobile/addresses/src/index.ts"],
"@next-pwa-app/mobile/advertising": ["libs/mobile/advertising/src/index.ts"],
"@next-pwa-app/mobile/auth": ["libs/mobile/auth/src/index.ts"],
"@next-pwa-app/mobile/booking": ["libs/mobile/booking/src/index.ts"],
"@next-pwa-app/mobile/browse": ["libs/mobile/browse/src/index.ts"],
"@next-pwa-app/mobile/browse-boosted": ["libs/mobile/browse-boosted/src/index.ts"],
"@next-pwa-app/mobile/calendar": ["libs/mobile/calendar/src/index.ts"],
"@next-pwa-app/mobile/cart": ["libs/mobile/cart/src/index.ts"],
"@next-pwa-app/mobile/core": ["libs/mobile/core/src/index.ts"],
"@next-pwa-app/mobile/core/config": ["libs/mobile/core/src/features/config/index.ts"],
"@next-pwa-app/mobile/core/localization": [
"libs/mobile/core/src/features/localization/index.ts"
],
"@next-pwa-app/mobile/core/navigation": ["libs/mobile/core/src/features/navigation/index.ts"],
"@next-pwa-app/mobile/core/permissions": [
"libs/mobile/core/src/features/permissions/index.ts"
],
"@next-pwa-app/mobile/core/legacy-integration": [
"libs/mobile/core/src/features/legacy-integration/index.ts"
],
"@next-pwa-app/mobile/data-access/*": ["libs/mobile/data-access/src/*"],
"@next-pwa-app/mobile/deal": ["libs/mobile/deal/src/index.ts"],
"@next-pwa-app/mobile/deal-card": ["libs/mobile/deal-card/src/index.ts"],
"@next-pwa-app/mobile/emea": ["libs/mobile/emea/src/index.ts"],
"@next-pwa-app/mobile/gift-card": ["libs/mobile/gift-card/src/index.ts"],
"@next-pwa-app/mobile/gifts": ["libs/mobile/gifts/src/index.ts"],
"@next-pwa-app/mobile/global": ["libs/mobile/global/src/index.ts"],
"@next-pwa-app/mobile/homepage": ["libs/mobile/homepage/src/index.ts"],
"@next-pwa-app/mobile/homepage-boosted": ["libs/mobile/homepage-boosted/src/index.ts"],
"@next-pwa-app/mobile/localization": ["libs/mobile/localization/src/index.ts"],
"@next-pwa-app/mobile/locations": ["libs/mobile/locations/src/index.ts"],
"@next-pwa-app/mobile/my-groupons": ["libs/mobile/my-groupons/src/index.ts"],
"@next-pwa-app/mobile/onboarding": ["libs/mobile/onboarding/src/index.ts"],
"@next-pwa-app/mobile/payments": ["libs/mobile/payments/src/index.ts"],
"@next-pwa-app/mobile/push-notifications": ["libs/mobile/push-notifications/src/index.ts"],
"@next-pwa-app/mobile/recaptcha": ["libs/mobile/recaptcha/src/index.ts"],
"@next-pwa-app/mobile/recent-deals": ["libs/mobile/recent-deals/src/index.ts"],
"@next-pwa-app/mobile/search": ["libs/mobile/search/src/index.ts"],
"@next-pwa-app/mobile/test-utils": ["libs/mobile/test-utils/src/index.ts"],
"@next-pwa-app/mobile/user": ["libs/mobile/user/src/index.ts"],
"@next-pwa-app/mobile/wishlist": ["libs/mobile/wishlist/src/index.ts"],
"@next-pwa-app/plugins": ["libs/plugins/src/index.ts"],
"@next-pwa-app/static": ["libs/static/src/index.ts"],
"@next-pwa-app/web/bookability/*": ["libs/web/bookability/src/*"],
"@next-pwa-app/web/browse-v2/*": ["libs/web/browse-v2/src/*"],
"@next-pwa-app/web/browse/*": ["libs/web/browse/src/*"],
"@next-pwa-app/web/cart": ["libs/web/cart/src/index.ts"],
"@next-pwa-app/web/checkout/*": ["libs/web/checkout/src/*"],
"@next-pwa-app/web/contexts/*": ["libs/web/contexts/src/*"],
"@next-pwa-app/web/core/*": ["libs/web/core/src/*"],
"@next-pwa-app/web/deal/*": ["libs/web/deal/src/*"],
"@next-pwa-app/web/error/*": ["libs/web/error/src/*"],
"@next-pwa-app/web/gift/*": ["libs/web/gift/src/*"],
"@next-pwa-app/web/gifts/*": ["libs/web/gifts/src/*"],
"@next-pwa-app/web/homepage-v2/*": ["libs/web/homepage-v2/src/*"],
"@next-pwa-app/web/homepage/*": ["libs/web/homepage/src/*"],
"@next-pwa-app/web/layout/*": ["libs/web/layout/src/*"],
"@next-pwa-app/web/merchant/*": ["libs/web/merchant/src/*"],
"@next-pwa-app/web/my-account/*": ["libs/web/my-account/src/*"],
"@next-pwa-app/web/mygroupons/*": ["libs/web/mygroupons/src/*"],
"@next-pwa-app/web/optimize-inspectors/*": ["libs/web/optimize-inspectors/src/*"],
"@next-pwa-app/web/receipt/*": ["libs/web/receipt/src/*"],
"@next-pwa-app/web/rokt/*": ["libs/web/rokt/src/*"],
"@next-pwa-app/web/test-utils/*": ["libs/web/test-utils/src/*"],
"@next-pwa-app/web/user-session/*": ["libs/web/user-session/src/*"],
"@next-pwa-app/web/wishlist/*": ["libs/web/wishlist/src/*"],
"@next-pwa-app/web/wolfhound/*": ["libs/web/wolfhound/src/*"],
"@maplibre/maplibre-react-native": ["libs/mobile/core/types/maplibre-react-native"]
}
}
}
and this is my nx report
:
> NX Report complete - copy this into the issue template
Node : 18.20.4
OS : darwin-arm64
pnpm : 8.15.9
nx (global) : 19.6.1
nx : 16.5.1
@nx/js : 16.10.0
@nrwl/js : 16.4.0
@nx/jest : 16.10.0
@nrwl/jest : 16.4.0
@nx/linter : 16.3.2
@nrwl/linter : 16.4.0
@nx/workspace : 16.3.2
@nrwl/workspace : 16.4.0
@nx/cypress : 16.4.1
@nx/detox : 16.4.0
@nx/devkit : 16.10.0
@nx/eslint-plugin : 16.3.2
@nx/expo : 19.5.7
@nx/next : 16.3.2
@nx/plugin : 16.10.0
@nx/react : 16.3.2
@nrwl/react : 16.4.0
@nx/react-native : 19.5.7
@nx/storybook : 16.4.1
@nrwl/tao : 16.5.1
@nx/vite : 16.3.2
@nx/web : 19.5.7
@nrwl/web : 16.4.0
@nx/webpack : 19.5.7
typescript : 5.4.5
---------------------------------------
Local workspace plugins:
react-native-akamai-bmp
react-native-payments
keychain
signifyd
@next-pwa-app/generators
axs
---------------------------------------
The following packages should match the installed version of nx
- @nx/js@16.10.0
- @nrwl/js@16.4.0
- @nx/jest@16.10.0
- @nrwl/jest@16.4.0
- @nx/linter@16.3.2
- @nrwl/linter@16.4.0
- @nx/workspace@16.3.2
- @nrwl/workspace@16.4.0
- @nx/cypress@16.4.1
- @nrwl/cypress@16.4.1
- @nx/detox@16.4.0
- @nrwl/detox@16.4.0
- @nx/devkit@16.10.0
- @nrwl/devkit@16.10.0
- @nx/eslint-plugin@16.3.2
- @nrwl/eslint-plugin-nx@16.3.2
- @nx/expo@19.5.7
- @nrwl/expo@19.5.7
- @nx/next@16.3.2
- @nrwl/next@16.3.2
- @nx/plugin@16.10.0
- @nrwl/nx-plugin@16.10.0
- @nx/react@16.3.2
- @nrwl/react@16.4.0
- @nx/react-native@19.5.7
- @nrwl/react-native@19.5.7
- @nx/storybook@16.4.1
- @nrwl/storybook@16.4.1
- @nx/vite@16.3.2
- @nrwl/vite@16.3.2
- @nx/web@19.5.7
- @nrwl/web@16.4.0
- @nx/webpack@19.5.7
- @nrwl/webpack@19.5.7
To fix this, run `nx migrate nx@19.5.7`
I understand this looks horrible 😄 we can justify using different versions for mobile (expo, global) and the rest of the project, but the number of different versions in this report is overwhelming 😅
To be honest I'm not sure that's related to the ts server crashing... tho I do wonder about your reason for having that many different nx versions? There are bound to be so many errors.
I have an experiment I would like you to run: In your tsconfig.base.json
, you have some projects that have a *
so you can import any relative files as well as from the barrel file. In an empty editor, could you open just files from these projects one by one and see if the ts server makes any jumps when that happens? Also, see if the ts server still crashes if you specifically avoid opening files from those projects. I think it could be related. Thanks!
honestly there's no excuse for the versions, it's just that there were partial upgrades and probably nx migrate
wasn't used? or it didn't work, and nobody ever made time to reconcile the versions.
a test I did now:
tsconfig.base.json
libs/web/bookability/src/utils/helpers.ts
helpers.ts
continuing:
libs/static/src/index.ts
index.ts
repeated for both of these files, commenting out all the imports and even the whole file content and reloading VSCode - no change.
next thing I've done is adding "typescript.tsserver.log": "verbose",
to settings.json, this is a log produced for one such problematic server run (for the libs/static/src/index.ts
file with all lines commented out):
tsserver.log (9.1 MB)
and here is a log for the same situation but with Nx Console extension disabled: tsserver.log (1.1 MB) this server is still running and line are being added, but the CPU usage is 0, and memory consumption stabilized at 393MB
lines 12747-12759 in the problematic log file show:
Info 1134 [11:04:41.953] request:
{"seq":30,"type":"request","command":"configurePlugin","arguments":{"pluginName":"@monodon/typescript-nx-imports-plugin","configuration":{"externalFiles":[{"mainFile":"/Users/richard/repos/grpn/mbnxt/libs/api/data-sources/src/index.ts","directory":"/Users/richard/repos/grpn/mbnxt/libs/api/data-sources"},
<whole lot of files here>
Info 1135 [11:04:41.955] NX Imports Plugin: onConfigurationChanged called, {"externalFiles":[
<whole lot of files here>
Info 1136 [11:04:41.959] NX Imports Plugin: setting configuration {"externalFiles":[
<whole lot of files here>
Info 1137 [11:04:41.961] NX Imports Plugin: updating project: /Users/richard/repos/grpn/mbnxt/libs/static/tsconfig.json
Info 1138 [11:04:41.966] NX Imports Plugin: get root files: {"externalFiles":[
<whole lot of files here>
Info 1139 [11:04:41.968] NX Imports Plugin: project directory: /Users/richard/repos/grpn/mbnxt/libs/static
Info 1140 [11:04:41.970] NX Imports Plugin: root files: [
<whole lot of files here>
Info 1141 [11:04:41.977] NX Imports Plugin: onConfigurationChanged called, {"externalFiles":[
<whole lot of files here>
Info 1142 [11:04:41.990] NX Imports Plugin: setting configuration {"externalFiles":[
<whole lot of files here>
Info 1143 [11:04:41.994] NX Imports Plugin: updating project: /Users/richard/repos/grpn/mbnxt/libs/static/tsconfig.lib.json
Info 1144 [11:04:41.995] NX Imports Plugin: get root files: {"externalFiles":[
<whole lot of files here>
Info 1145 [11:04:41.998] NX Imports Plugin: project directory: /Users/richard/repos/grpn/mbnxt/libs/static
Info 1146 [11:04:41.999] NX Imports Plugin: root files: [
<whole lot of files here>
I'd guess the extension/plugin somehow makes the TS server try to load the whole project
Should be fixed with https://github.com/nrwl/nx-console/pull/2248
Once our new tsc support lands, this will all be a thing of the past anyways :)
You can disable those errors in the vscode setting nxConsole.enableLibraryImports
I see the fix hasn't been released yet, what's the release process?
I'll try to release it today :)
just pushed the release :)
thanks! I'll report back if I still encounter any issues 🙂
yes please that would be great! I appreciate the help :)
it looks fine now. I'm still getting troubles with tsserver or fileWatcher spikes sometimes, but they don't seem to be happening because of the Nx extension 🙂 thanks
Type: Bug
Hi, I'm using nx on a large work project (tens of libs). We have nx 16.5.1 for most of the project, but for the mobile app we're using nx 19.5.7+ to run commands.
Anyway, the TS server in VSCode was unusable for me, it just loaded, bulked up memory to the 4 GB limit, then crashed and repeated. I tried running it separately via node and passing it even 12 GB limit, it did the same - the memory spiked fast to the limit and then restarted. Using the extension bisect I was able to pinpoint Nx Console extension as the culprit.
My node installation is managed via Volta (www.volta.sh), and I had trouble running our weird 2-version Nx setup with it, the solution for me was to remove the
"nx": "^16.5.1"
version line from our package.json so the nx doesn't find the local installation. I wonder if this could be the thing confusing the Nx extension.Extension version: 18.26.0 VS Code version: Code 1.92.2 (Universal) (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z) OS version: Darwin arm64 23.6.0 Modes:
System Info
|Item|Value| |---|---| |CPUs|Apple M1 Max (10 x 2400)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|13, 17, 12| |Memory (System)|32.00GB (5.59GB free)| |Process Argv|--crash-reporter-id df5fd0c8-18ef-4591-818d-71e7e68b1bde| |Screen Reader|yes| |VM|0%|
A/B Experiments
``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 vscrpc:30673769 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 nativerepl1:31104043 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31119336 wkspc-onlycs-c:31111717 wkspc-ranged-t:31125599 ei213698:31121563 aajjf12562cf:31125794 ```