【发布时间】:2017-01-12 06:45:43
【问题描述】:
我使用 npm、webpack 和 FullCalendar,但是在使用 fullcalendar 时在浏览器控制台中出现以下错误:
main.js:37556 Uncaught TypeError: (0 , _jquery2.default)(...).fullCalendar is not a function
我该如何解决这个问题?
我使用 FullCalendar 3.0.0-beta 和 jquery 3.1.0。我的代码如下。
index.js:
import $ from 'jquery'
import jQueryUI from 'jquery-ui'
import moment from 'moment'
import fullCalendar from 'fullcalendar'
$('#timetable').fullCalendar({
editable: true,
firstDay: 1,
droppable: true,
})
webpack.config.js:
var path = require("path")
var webpack = require("webpack")
var BundleTracker = require("webpack-bundle-tracker")
module.exports = {
context: __dirname,
entry: [
'fullcalendar',
'./static/index',
],
output: {
path: path.resolve('./static/bundles/'),
filename: "[name].js",
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
],
resolve: {
modulesDirectories: ['node_modules'],
extensions: ['', '.js'],
},
module: {
loaders:[
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015'] } }
]
}
}
【问题讨论】:
-
你有凉亭吗?
-
@Anokrize 不,我使用 npm。
标签: javascript npm webpack fullcalendar