Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#2,208 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, vite
Lĩnh vực
frontend

Hướng nghiên cứu

Tái hiện ứng dụng Vue 2.7.14 với Vite 4.1.4 bằng vite build, sau đó kiểm tra tệp được tạo @appbase-io/reactivesearch-vue/dist/es/ssr-03607d84.js và tệp tương ứng của phiên bản 3.0.0-rc.2. Kiểm tra cách import RangeSlider được tải trong trình duyệt và xác minh rằng bản sửa lỗi vừa loại bỏ lỗi require, vừa khởi tạo component slider.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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
Ngôn ngữ chính
JavaScript
Star
4.9k
Fork
479
Merge trung bình
4 ngày 10 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của appbaseio/reactivesearch

Tất cả issue của appbaseio/reactivesearch

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.