appbaseio / appbaseio/reactivesearch

Unable to load vue-slider ReferenceError: require is not defined (Vue.JS/Vite)

Abierto
#2,208 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
JavaScript
Estrellas
4.9k
Forks
478
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Affected Projects** Vue.JS 2.7.14 with Vite 4.1.4

**Library Version:** 1.33.13

**Describe the bug** After building, the browser throws an error trying import the RangeSlider component: `Unable to load vue-slider ReferenceError: require is not defined`. Looking at the 3.x-rc, the code has been updated from:

**1.33.13: @appbase-io/reactivesearch-vue/dist/es/ssr-03607d84.js**
```
components['vue-slider-component'] = require('vue-slider-component');
```

to

**3.0.0-rc.2: @appbase-io/reactivesearch-vue/dist/es/ssr-c630ccb9.js**
```
try {
if (typeof window !== 'undefined') {
components['vue-slider-component'] = function () {
return import('vue-slider-component');
};
}
}
```

Patching this removes the error but the slider does not initialize.

**To Reproduce**

Build a vue2/vite app, add a rangeslider and build with `vite build`

**Expected behavior**

RangeSlider component imports without error

**Desktop (please complete the following information):**
- OS: Mac OS Ventura 13.3.1
- Browser: Chrome 112.0.5615.49

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.