Skip to content

useScriptTag won't run script type: module second time #3862

@IlyaSemenov

Description

@IlyaSemenov

Describe the bug

Using useScriptTag with <script type="module"> doesn't work. The script will only execute (run its side effects) on first load, but it won't re-execute the second time.

This is perhaps not a bug in the technical sense but rather lack of specific workarounds (e.g. adding ?v=<random> to the URL fixes the problem, albeit being very suboptimal), but from user's point of view it's simply not working.

Reproduction

https://stackblitz.com/edit/nuxt-starter-cbmqng

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @vueuse/core: ^10.9.0 => 10.9.0 
    vue: ^3.4.21 => 3.4.21

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions