appbaseio / appbaseio/reactivesearch
Unable to load vue-slider ReferenceError: require is not defined (Vue.JS/Vite)
- Vorherrschende Sprache
- JavaScript
- Sterne
- 4.9k
- Forks
- 478
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**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
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.