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

The string "export default defineComponent" is being compiled abnormally #345

Open
8 of 9 tasks
OMGVecchio opened this issue Jan 27, 2024 · 1 comment
Open
8 of 9 tasks
Labels
p2-has-workaround 🍰 Bug, but has workaround (priority)

Comments

@OMGVecchio
Copy link

OMGVecchio commented Jan 27, 2024

Related plugins

Describe the bug

import { defineComponent } from 'vue';

const monacoEditorTemplateCode = 'export default defineComponent';

export default defineComponent({
  setup() {
    return () => monacoEditorTemplateCode;
  },
});

monacoEditorTemplateCode will be compiled to const __default__ = defineComponent under the following conditions: has default exportJSXHMR or SSR

Reproduction

https://stackblitz.com/edit/vitejs-vite-rgsvev?file=src%2FApp.tsx

Steps to reproduce

# Reproduces only in the development environment.
npm run dev

System Info

System:
    OS: macOS 12.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 5.07 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.17.1/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    pnpm: 7.15.0 - ~/Library/pnpm/pnpm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Edge: 121.0.2277.83
    Safari: 16.0

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red sapphi-red added p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) and removed pending triage labels Feb 27, 2024
@edison1105
Copy link
Member

a workaround

const monacoEditorTemplateCode = 'export '+'default defineComponent';

@edison1105 edison1105 added p2-has-workaround 🍰 Bug, but has workaround (priority) and removed p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-has-workaround 🍰 Bug, but has workaround (priority)
Projects
None yet
Development

No branches or pull requests

3 participants