因此,我最近将我的应用程序更新为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');
然后是我的package.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",
},
答案 0 :(得分:0)
有一个余烬组件“ ember-fulcalendar”: https://github.com/scoutforpets/ember-fullcalendar/
package.json中包含以下内容: “ fullcalendar”:“ ^ 3.6.0”, “ fullcalendar-scheduler”:“ ^ 1.8.0”
您可以切换为使用该组件,或者查看该组件的工作方式。
答案 1 :(得分:0)
要通过导入解决您的第三方库,ember需要供应商填充程序。您可以检查here 只需运行
ember generate vendor-shim fullcalendar
导入供应商shim到ember-cli-build,最后导入完整的日历。 顺便说一下,有一个full calendar的包装器。