Skip to content

Loading 3rd party scripts for unused widget #882

Description

@gregor-tusar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    harlan-agent-wait-to-implementIssue triage found work that should wait before implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions