【问题标题】:require.config is not a function in .js filerequire.config 不是 .js 文件中的函数
【发布时间】:2020-04-05 02:49:24
【问题描述】:

我正在使用 .js 文件,我刚刚玩过代码,我发现了错误

require.config 不是函数 我能为此做些什么?请帮帮我!

代码在这里

require.config({
  paths: {
    'mobiledetect': 'https://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.4.4/mobile-detect.min'
  }
});
require(['mobiledetect'], function (MobileDetect) {
  var detector = new MobileDetect(window.navigator.userAgent)

  console.log("Mobile: " + detector.mobile());
  console.log("Phone: " + detector.phone());
  console.log("Tablet: " + detector.tablet());
  console.log("OS: " + detector.os());
  console.log("userAgent: " + detector.userAgent());

});

最好的问候, 帕雷什帕瓦尔

【问题讨论】:

标签: javascript node.js


【解决方案1】:

你想做什么?
Javascript 没有名为 require
的本机模块 也许你需要安装一个依赖才能让它工作

【讨论】:

    猜你喜欢
    • 2014-01-19
    • 2019-07-10
    • 1970-01-01
    • 1970-01-01
    • 2017-11-24
    • 1970-01-01
    • 2015-05-07
    • 1970-01-01
    • 2021-01-08
    相关资源
    最近更新 更多