ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

Error: Could not find module `jszip` imported from `(require)` #62

Closed Dzoay closed 8 years ago

Dzoay commented 8 years ago

I have created a brand new ember-cli app, installed ember-browserify and then npm install --save-dev xlsx (a js library to manipulate spreadsheets). I then imported xlsx as import Xlsx from 'npm:xlsx'; into a service sheet and injected that service into a route thus:

import Ember from 'ember';
const { Route, inject } = Ember;

export default Route.extend({
  sheet: inject.service(),
  model() {
    return this.get('sheet').RetrieveRows(); // attempting to get some particular rows from the sheet service
  }
});

App builds fine but on going to the page that uses the route I get this error:

Error: Could not find module `jszip` imported from `(require)`
    at missingModule (loader.js:135)
    at findModule (loader.js:150)
    at requireModule (loader.js:139)
    at s (_prelude.js:1)
    at _prelude.js:1
    at make_xlsx (xlsx.js:1339)
    at Object.<anonymous> (xlsx.js:11654)
    at Object. [app path]\node_modules\XLSX\xlsx.js../dist/cpexcel (xlsx.js:11657)
    at s (_prelude.js:1)
    at _prelude.js:1

Any ideas what I am missing here?

asakusuma commented 8 years ago

Can you try installing as a regular dependency and not a dev dependency?

neilor commented 8 years ago

I'm having this same issue.

@asakusuma, I've tried installing as regular dependency but didn't work too.

@Dzoay, Do you found an solution for this?

stefanpenner commented 8 years ago

the library in question does not browserify atleast with defaults (just tried i manually), I'm not sure we can do much, in theory maybe some mode of browserify may enable this, please do investigate and report back. But for now i think we should close this.

fredguth commented 8 years ago

@Dzoay Did you find a solution or a working package? Thanks