Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Not working with webpack #349

Open
MikaAK opened this issue Nov 21, 2015 · 16 comments
Open

Not working with webpack #349

MikaAK opened this issue Nov 21, 2015 · 16 comments

Comments

@MikaAK
Copy link

MikaAK commented Nov 21, 2015

When used with webpack via npm it complains about not finding fullCalendar. This is due to fullCalendar not being a dependency within the package.json. Can this be fixed please for all the people who use npm over bower?

@simon-nguyen
Copy link

@MikaAK Have you tried installed 'fullcalendar' package via npm? I'm using webpack too and trying to make the UI Calendar work... but I got 'moment is not defined' error (I've install moment and angularMoment before). Any idea for this?

@MikaAK
Copy link
Author

MikaAK commented Nov 27, 2015

@simon-nguyen yes if you go via that route you must include moment and fullcalendar into scripts-loader

@simon-nguyen
Copy link

@MikaAK Thanks for the suggestion. I did npm-install --save script-loader and inside my webpack.config.js I put

require('script!../../../node_modules/moment/moment.js');
require('script!../../../node_modules/fullcalendar/dist/fullcalendar.js');
...
module.exports: {
...
}

Now I've got a new error

> webpack-dev-server.cmd --content-base src/client --history-api-fallback --hot --inline

path-to-app\node_modules\fullcalendar\dist\fullcalendar.js:25
$.fn.fullCalendar = function(options) {
                  ^

TypeError: Cannot set property 'fullCalendar' of undefined
    at path-to-app\node_modules\fullcalendar\dist\fullcalendar.js:25:1
9
    at $.fullCalendar.version (path-to-app\node_modules\fullcalendar\d
ist\fullcalendar.js:12:20)
    at Object.<anonymous> (path-to-app\node_modules\fullcalendar\dist\
fullcalendar.js:17:3)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (...app\webpack.config.js:10:1)

Could you help me with it? Much appreciation!

@MikaAK
Copy link
Author

MikaAK commented Nov 30, 2015

@simon-nguyen You must include jquery with script-loader as well. All things to do with this and moment will need to be put through script-loader due to this. It's not super friendly!

@stringbeans
Copy link

+1 please add full calendar as an npm dependency

@simon-nguyen
Copy link

@MikaAK Thank you so much for your reply... Sadly, I have to move to Angular Bootstrap Calendar, it's more friendly and easy to use for my case.

@aneurysmjs
Copy link

npm please, I'm refactoring a big app with webpack and es6, this is not cool to do it, please please, npm npm :)

@MikaAK
Copy link
Author

MikaAK commented Dec 11, 2015

@blackendstudios I've forked the repo and added the nessisary requires if you wanna use that till they support this. https://github.com/MikaAK/ui-calendar. In your package.json put 'angular-ui-calendar': 'mikaak/ui-calendar'

@aneurysmjs
Copy link

@MikaAK mmmmm I saw that momment, fullcalendar and jquery are in npm, if I install them, then I would need to make it work just with the ui-calendar? ... why too much trouble to make it compatible with npm, is too much to get it work?

@aneurysmjs
Copy link

seriously, too much trouble to make this on npm??? wow

@johankvint
Copy link

Have someone got this to work with npm and webpack?
Seams no matter what I do I only get "scope.calendar.fullCalendar is not a function".

I am trying to use this in a angular component from angular 1.5

@MikaAK
Copy link
Author

MikaAK commented Feb 28, 2016

@cybercomkvint I forked it and we use the fork successfully at work see Here

@phdesign
Copy link

Hi, I have this working happily with webpack, here's my setup.

package.json

"dependencies": {
    ...
    "angular-ui-calendar": "^1.0.2",
    "fullcalendar": "^3.0.0",
    "jquery": "~2.1.4",
    "moment": "~2.15.0",
    ...
}

webpack.config.js

plugins: [
    new webpack.ProvidePlugin({
        $: "jquery",
        "window.jQuery": "jquery",
        "moment": "moment"
    })
]

directive.js

var angular = require('angular');
require('fullcalendar');
require('angular-ui-calendar');

angular
    .module('my-calendar-view', [ 'ui.calendar' ])
    .directive(...)

@rfsbsb
Copy link

rfsbsb commented Jan 19, 2017

@phdesign this should be on the official documentation!

@gintsgints
Copy link

Acctually this directive should be updated, so it works correctly with webpack.

@wesley100002001
Copy link

Using ES6 working as a charm as well

import angular from 'angular';
import fullcalendar from 'fullcalendar';
import uicalendar from 'angular-ui-calendar';

angular.module('calendar-view', ['ui.calendar'])

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants