jbaysolutions / vue-grid-layout

A draggable and resizable grid layout, for Vue.js.
https://jbaysolutions.github.io/vue-grid-layout/
MIT License
7.08k stars 1.49k forks source link

Issue importing through require / browserify. #232

Open jungleBadger opened 5 years ago

jungleBadger commented 5 years ago

Hi there, previously on version "vue-grid-layout": "^2.1.13", I could do the following:

const VueGridLayout = require("vue-grid-layout");

let GridItem = VueGridLayout.GridItem;
let GridLayout = VueGridLayout.GridLayout;

But working with the version ^2.2.0 I cannot require it anymore without errors.

I have tried to import the lib itself (require("vue-grid-layout")) and also the common js file (require("vue-grid-layout/dist/vue-grid-layout.common")) and both options throw me this error while bundling:

{ Error: Cannot find module './isWindow' from '/Users/dcerag@br.ibm.com/Desktop/ibm/designstudio/node_modules/vue-grid-layout/dist'

I've also tried import the src file directly, which complains about the import statement due to my build process:

{ Error: Parsing file /Users/dcerag@br.ibm.com/Desktop/ibm/designstudio/node_modules/vue-grid-layout/src/components/GridItem.vue: Unexpected token (1:0)

Could you please advise how can I simply require your lib (which is awesome btw) and start to work with?

Thanks in advance

gmsa commented 5 years ago

Sorry, but can find anything on vue-grid-layout with "isWindow". You can check out a usage sample here: https://github.com/jbaysolutions/vue-grid-layout-sample-v2

jungleBadger commented 5 years ago

Line 12387 from the vue-grid-layout.common.js:

var isWindow = require('./isWindow');

I believe it is something bundled together and my gulp process is trying to re-bundle. I've tried to research some way of just inserting the lib code within my own bundle without evaluating anything, but unsuccessful so far.

I appreciate your sample but it is also using import statements, which I'm avoiding at this moment.

gmsa commented 5 years ago

Can you provide a sample project to reproduce this problem?