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

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

Open
egoist opened this issue Feb 25, 2021 · 0 comments
Open

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

egoist opened this issue Feb 25, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@egoist
Copy link
Collaborator

egoist commented Feb 25, 2021

<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.

@egoist egoist added the bug Something isn't working label Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant