jelgblad / angular2-masonry

https://github.com/desandro/masonry module for Angular2
101 stars 48 forks source link

SystemJs Static Bundle ErrorUncaught Module ./item not present. #2

Open naveedahmed1 opened 8 years ago

naveedahmed1 commented 8 years ago

Hi,

When I use SystemJS builder.buildStatic to bundle my app and run it in browser, the application doesn't work and I see the below error on the console:

bundle.js:1 Uncaught Module ./item not present.

I am following the instructions mentioned on:

https://github.com/jelgblad/angular2-masonry

Everything works fine, if I don't create a bundle.

Can anyone please guide?

jelgblad commented 8 years ago

Hi! I haven't tried bundling any Angular2 apps, but I will try to look into it. Are you sure the issue is with this package? If you find a solution please let me know :)

n0mid commented 8 years ago

I have the same problem. Do you have any solutions ?

j-muller commented 7 years ago

Same problem here, and can't get any viable solution at the moment.

sjwall commented 7 years ago

I have come across the same problem and it looks like it is an issue with how outlayer is packaged into masonry.pkgd.js. I found 2 solutions:

Solution 1

Change SystemJS configuration to look like:

paths: {
     "npm:": "./node_modules/"
},
packages: {
     "angular2-masonry": { "defaultExtension": "js", "main": "index" },
     "outlayer": { "defaultExtension": "js" }
},
map: {
      "angular2-masonry": "npm:angular2-masonry",
      "masonry-layout": "npm:masonry-layout/masonry.js",
      "outlayer": "npm:outlayer",
      "get-size/get-size": "npm:get-size/get-size.js",
      "ev-emitter/ev-emitter": "npm:ev-emitter/ev-emitter.js",
      "fizzy-ui-utils/utils": "npm:fizzy-ui-utils/utils.js",
      "desandro-matches-selector/matches-selector": "npm:desandro-matches-selector/matches-selector.js",
}

Solution 2

Change how ./item is required/defined in the masonry.pkgd.js and masonry.pkgd.min.js files. Simply replace the 2 instances that "./item" occurs with "outlayer/item"