Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 21, 2021. It is now read-only.
This repository was archived by the owner on Nov 21, 2021. It is now read-only.

Using preload with <script setup> will leak server-side imports #200

@egoist

Description

@egoist
<script>
import fs from 'fs'

export const preload = () => {
  return {
    data: {
       content: fs.readFileSync('foo.md', 'utf8')
    }
  }
}
</script>

<script setup>
// ...
</script>

fs will be unexpectedly added to setup() function even if it's not imported in <script setup> but a regular <script> block, this is a known issue of @vue/compiler-sfc.

The workaround is to not to use preload with the <script setup> block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions