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

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

Open
alancwoo opened this issue Apr 18, 2023 · 0 comments
Labels

Comments

@alancwoo
Copy link

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
@alancwoo alancwoo added the bug label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant