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

Vite fails to build project with emoji-mart-vue #287

Closed
steakscience opened this issue Aug 3, 2023 · 5 comments
Closed

Vite fails to build project with emoji-mart-vue #287

steakscience opened this issue Aug 3, 2023 · 5 comments
Labels
question Further information is requested

Comments

@steakscience
Copy link

Is anyone else getting this error? I'm using Nuxt, which uses Vite

[nitro 7:05:19 PM]  ERROR  RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)


1: <template>
   ^
2:   <div role="tablist" class="emoji-mart-anchors">
3:     <button


[7:05:19 PM]  ERROR  Unexpected token (Note that you need plugins to import files that are not JavaScript)

  at error (node_modules/.pnpm/rollup@3.27.1/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
  at Module.error (node_modules/.pnpm/rollup@3.27.1/node_modules/rollup/dist/es/shared/node-entry.js:13674:16)
  at Module.tryParse (node_modules/.pnpm/rollup@3.27.1/node_modules/rollup/dist/es/shared/node-entry.js:14405:25)
  at Module.setSource (node_modules/.pnpm/rollup@3.27.1/node_modules/rollup/dist/es/shared/node-entry.js:14006:39)
  at ModuleLoader.addModuleSource (node_modules/.pnpm/rollup@3.27.1/node_modules/rollup/dist/es/shared/node-entry.js:24523:20)

 ELIFECYCLE  Command failed with exit code 1.
@serebrov
Copy link
Owner

serebrov commented Aug 7, 2023

@steakscience Could you provide an example of the code or repository that reproduces the problem?

Also, maybe the error ("Note that you need plugins to import files that are not JavaScript") is correct and you need to add some plugins to import .vue files?

Might be related: #107, #140.

@steakscience
Copy link
Author

@serebrov Here is an example repo (clean Nuxt starter with emoji-mart-vue) https://stackblitz.com/edit/nuxt-starter-avagg9?file=components%2FEmojiPicker.vue

Once we run build, it will fail

I will also look into plugins for importing .vue to see if that could be the cause.

@leonwisdom
Copy link

leonwisdom commented Nov 29, 2023

@steakscience I am also getting this error when building a nuxt 3 project. Did you manage to solve this?

This is my nuxt plugin for emoji mart:

import { Picker } from "emoji-mart-vue-fast/src";

const plugin = defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.component('Picker', Picker);
});

export default plugin;

@steakscience
Copy link
Author

@leonwisdom I don't remember :D

@RickySharki
Copy link

@leonwisdom hey bro, I'm having the same problem as you.
I fixed it by adding this to nuxt.config.ts:
build: { transpile: ['emoji-mart-vue-fast'] }

@serebrov serebrov added the question Further information is requested label Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants