Skip to content

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

Closed
@OMGVecchio

Description

@OMGVecchio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions