requireJs 中引入报 xmSelect is not defined

      发布在:前端技术      评论:0 条评论

该问题是怎么引起的?

requireJs 中引入报 xmSelect is not defined

重现步骤

require.config({    paths: {        "xmSelect": ["plugs/lay-module/xmSelect/xm-select"],    }
});define(["xmSelect"], function (xmSelect) {    })

报错信息

xmSelect is not defined

查看 xm-select 报错的源代码

"object" === ("undefined" == typeof exports ? "undefined" : _typeof(exports)) ? e.exports = t.c : "function" == typeof define && n(221) ? define(xmSelect) : window.layui && layui.define && layui.define((function (e) {e("xmSelect", t.c)}))

全局搜索了确实发现 xmSelect 变量的定义,改为以下代码就好了

"object" === ("undefined" == typeof exports ? "undefined" : _typeof(exports)) ? e.exports = t.c : "function" == typeof define && n(221) ? define(function() {return t.c}) : window.layui && layui.define && layui.define((function (e) { e("xmSelect", t.c)}))

来源:https://toscode.gitee.com/maplemei/xm-select/issues/I46MXW

相关文章
热门推荐