EmberJS 2.15.1 找不到模块“全日历”



所以我最近将我的应用程序更新到 Ember 2.15.1,我正在尝试将所有内容从 Bower 切换到 NPM。 我一直在玩,试图让完整的日历合作,但没有太多运气(最后一个也切换了(。 认为这可能是一个缓存问题,所以NPM/Bower缓存和重新安装的NPM。 下面是错误和导入它的代码。

我在日历组件的顶部有import 'fullcalendar';

Uncaught Error: Could not find module `fullcalendar` imported from `name/components/calendar`
    at missingModule (loader.js:247)
    at findModule (loader.js:258)
    at Module.findDeps (loader.js:168)
    at findModule (loader.js:262)
    at requireModule (loader.js:24)
    at Class._extractDefaultExport (index.js:389)
    at Class.resolveOther (index.js:109)
    at Class.superWrapper [as resolveOther] (ember-utils.js:423)
    at Class.resolve (resolver.js:164)
    at resolve (container.js:873)

删除导入后,我收到标准fullCalendar is not a function错误。 删除/添加import $ from 'jquery';不会更改其中任何一个。这是它出错的代码部分,尽管删除它只会向下移动到下一次提及 fullCalendar。

 didInsertElement: function(){
      $('.sample-calendar').fullCalendar({
        header: {
          left: '',
          center: '',
          right: 'title prev,next'
        },
        events: [],
        theme: true,
        aspectRatio: 0
      });
    },

从 ember-cli-build 导入。

app.import('node_modules/fullcalendar/dist/fullcalendar.min.js');
app.import('node_modules/fullcalendar/dist/fullcalendar.min.css');
app.import('node_modules/fullcalendar/dist/plugins/gcal.min.js');

然后是我的包.json。

"devDependencies": {
    "broccoli-asset-rev": "^2.4.5",
    "ember-ajax": "^3.0.0",
    "ember-cli": "~2.15.1",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "^6.3.0",
    "ember-cli-datepicker": "wesm87/ember-datepicker#master",
    "ember-cli-dependency-checker": "^2.0.0",
    "ember-cli-eslint": "^4.0.0",
    "ember-cli-htmlbars": "^2.0.1",
    "ember-cli-htmlbars-inline-precompile": "^1.0.0",
    "ember-cli-inject-live-reload": "^1.4.1",
    "ember-cli-moment-shim": "~3.5.0",
    "ember-cli-qunit": "^4.0.0",
    "ember-cli-shims": "^1.1.0",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "~2.15.0",
    "ember-export-application-global": "^2.0.0",
    "ember-fetch": "3.4.0",
    "ember-load-initializers": "^1.0.0",
    "ember-moment": "~7.5.0",
    "ember-resolver": "^4.0.0",
    "ember-source": "~2.15.0",
    "eslint-plugin-ember": "~4.1.2",
    "fullcalendar": "^4.0.0-alpha.4",
    "loader.js": "^4.2.3",
    "pikaday": "~1.4.0",
  },

要使用导入解析您的第三方库,Ember需要供应商填充程序。 你可以在这里查看只需运行

ember generate vendor-shim fullcalendar

将供应商填充程序导入您的 Ember-CLI 构建,最后导入完整日历。顺便说一下,有一个完整日历的包装器。

有一个余烬组件"余烬-fulcalendar":https://github.com/scoutforpets/ember-fullcalendar/

它在package.json中具有以下内容:"完整日历": "^3.6.0","全日历调度程序": "^1.8.0">

您可以切换到使用该组件或查看组件如何执行此操作。

相关内容

  • 没有找到相关文章

最新更新