Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When configured with bridge.vite.legacy=true client scripts crash if the page has img tags with /static/ sources #1322

Open
KimotoYanke opened this issue Oct 4, 2024 · 0 comments

Comments

@KimotoYanke
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v18.20.4
  • Nuxt Version: 2.17.3
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Set up Nuxt2 default project, and migrate into @nuxt/bridge
https://nuxt.com/docs/bridge/overview

Configure as follows

import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig({
  bridge: {
    typescript: true,
    nitro: true,
    meta: false,
    vite: {
      legacy: false,
    },
  }
})

Place an image in /static/logo-green-white.png

And page component file:

<template>
  <div>
    <img src="/logo-green-white.png" alt="">
    <span v-if="isLoadingDone">done</span>
    <span v-else>not done</span>
  </div>
</template>

<script lang="ts">
import Vue from 'vue'

export default Vue.extend({
  name: 'IndexPage',
  data() {
    return {
      isLoadingDone: false
    };
  },
  mounted() {
    setTimeout(() => {
      this.isLoadingDone = true
    }, 5000)
  },
})
</script>

Production build and run
npm run build && npm run start

Describe the bug

Output to console.log

TypeError: globalThis.__publicAssetsURL is not a function
    at index-DVkd1gRf.js:1:190

And the execution of the script on that page will be stopped. The display should change to done after 5 seconds, but it does not.

Additional context

No response

Logs

TypeError: globalThis.__publicAssetsURL is not a function
    at index-DVkd1gRf.js:1:190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant