I am using Laravel framework with laravel-elixir, jquery-slim, vuejs, vue-resource npm packages.
My issue is that when I try to import a jquery plugin (ex. snackbarjs) its giving me an issue since the jquery module is not being recognised.
The error:
Browserify Failed!: Cannot find module 'jquery'
I know where the problem comes from, the snackbarjs in this case tries to require the jquery plugin using this code:
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
My app.js file looks like this:
import $ from 'jquery-slim';
import jQuery from 'jquery-slim';
import Vue from 'vue';
import VueResource from 'vue-resource';
import Vuex from 'vuex';
import 'snackbarjs';
Vue.use(VueResource);
Vue.use(Vuex);
Is there a way for snackbarjs to ignore the 'jquery' module requirement or to change the name of the module to 'jquery' from 'jquery-slim'?
Thanks in advance!
0 comments:
Post a Comment
Thanks