Loading 3rd party scripts for unused widget
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 584
- Forks
- 91
- Avg merge
- 1d 36m
- Merged PRs (30d)
- 29
Description
I run into an issue where loading a 3rd party widget fails in Gitlab job where the access to the internet is limited. The script that fails if used by a widget that is not used in the app at all. Would it be possible to not even load the 3rd party scripts if they are not referenced by the solution?
System:
@nuxt/scripts: 1.3.6
docker build in Gitlab actions
node:22.23.2
Here is the build output:
[@nuxt/scripts] ℹ Downloading script https://secure.gravatar.com/js/gprofiles.js → d1133547e8a1f280.js (21.38 kB br)
✓ 4471 modules transformed.
ERROR ✗ Build failed in 15.01s
│
■ Nuxt build error: Error: Build failed with 1 error:
│
│ [plugin nuxt:scripts:bundler-transformer] /src/src/MySolution/node_modules/@nuxt/scripts/dist/runtime/components/ScriptCalendlyInlineWidget.vue
│ FetchError: [GET] "https://assets.calendly.com/assets/external/widget.js": <no response> fetch failed
│ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
│ at async $fetchRaw2 (file:///src/src/MySolution/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs:286:14)
│ at async $fetchRaw2 (file:///src/src/MySolution/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs:286:14)
│ at async $fetch2.$fetchRaw2 [as raw] (file:///src/src/MySolution/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs:286:14)
│ at async downloadScript (file:///src/src/MySolution/node_modules/@nuxt/scripts/dist/module.mjs:1137:11)
│ at async file:///src/src/MySolution/node_modules/@nuxt/scripts/dist/module.mjs:1382:40
│ at async TransformPluginContextImpl.handler (file:///src/src/MySolution/node_modules/@nuxt/scripts/dist/module.mjs:1451:13)
│ at async plugin (file:///src/src/MySolution/node_modules/rolldown/dist/shared/bindingify-input-options-COG1sboO.mjs:1537:16)
│ at async plugin.<computed> (file:///src/src/MySolution/node_modules/rolldown/dist/shared/bindingify-input-options-COG1sboO.mjs:2125:12)
│ Caused by:
│ TypeError: fetch failed
│ Caused by:
│ Error: read ECONNRESET
│ at TLSWrap.onStreamRead (node:internal/stream_base_commons:216:20)
ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the bundler-transformer failure through dist/module.mjs, especially downloadScript, and inspect the unused dist/runtime/components/ScriptCalendlyInlineWidget.vue entry shown in the build output. Reproduce the failure with npm run build in the restricted-network setup. Done means unused widgets do not trigger third-party downloads while referenced widgets still load their scripts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, gitlab, node.js, nuxt, typescript
- Domain
- build-system, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100