Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#2,208 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, vite
领域
frontend

调研方向

使用 vite build 通过 Vite 4.1.4 重现 Vue 2.7.14 应用,然后检查生成的 @appbase-io/reactivesearch-vue/dist/es/ssr-03607d84.js 以及对应的 3.0.0-rc.2 文件。检查 RangeSlider import 在浏览器中的加载方式,并验证该修复既能移除 require 错误,也能初始化 slider 组件。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
JavaScript
星标
4.9k
派生
479
平均合并
4 天 10 小时
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

appbaseio/reactivesearch 的其他 Issue

查看 appbaseio/reactivesearch 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。