You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently facing a problem where I installed vue-select for my project and I'm unable to create the build when I run vite-ssg build it gives the following error bellow
Reproduction
add vue-select in a vite project, when run the build with vite-ssg it thorws the error
System Info
/node_modules/vue-select/dist/vue-select.es.js:13
import { openBlock as a, createElementBlock as h, createElementVNode as u, resolveDirective as K, normalizeClass as A, renderSlot as r, normalizeProps as d, guardReactiveProps as c, Fragment as B, renderList as L, createTextVNode as v, toDisplayString as D, createBlock as b, resolveDynamicComponent as _, createCommentVNode as O, mergeProps as k, toHandlers as j, withDirectives as w, vShow as P, createVNode as $, Transition as R, withCtx as z, withModifiers as F } from "vue";
^^^^^^
SyntaxError: Cannot use import statement outside a module
The issue is that vue-select is using methods that are not available in a nodeJS environment. In this case, the import method. A workaround I apply to these situations is to wrap the import statement in an if statement that checks for the window variable.
let vueSelect
if (typeof window !== "undefined") {
(async () => {
const vueSelect = await import("vue-select")
})()
}
Describe the bug
I'm currently facing a problem where I installed vue-select for my project and I'm unable to create the build when I run vite-ssg build it gives the following error bellow
Reproduction
add vue-select in a vite project, when run the build with vite-ssg it thorws the error
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: