I have a single component library that I build with Vite and when trying to consume it in a Vue CLI based app, it fails with Unexpected token 'export'. It appears to be something with the ESM build output by Vite. Webpack can read ESM, so I'm not sure why it doesn't work out of the box.
[x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[x] Provide a description in this issue that describes the bug.
[x] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
Describe the bug
I have a single component library that I build with Vite and when trying to consume it in a Vue CLI based app, it fails with
Unexpected token 'export'
. It appears to be something with the ESM build output by Vite. Webpack can read ESM, so I'm not sure why it doesn't work out of the box.Reproduction
vue-facebook-login-component-next
.vue-app-3.x
.System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager: yarn
Logs
Before submitting the issue, please make sure you do the following