ef4 / ember-browserify

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

Could not find module `npm:fetch-mock` trying to test ember-network/fetch #113

Open stephencattaneo opened 7 years ago

stephencattaneo commented 7 years ago

Hi. I'm trying to write a test with ember-network/fetch. The testing section (https://github.com/tomdale/ember-network#testing ) says to

npm install fetch-mock
ember install ember-browserify

Then in a test do

import fetchMock from 'npm:fetch-mock';

In a brand new ember-cli project I'm getting --

Could not find module `npm:fetch-mock` imported from `ember-sandbox/tests/acceptance/root-test`

repo for reproduction -- https://github.com/stephencattaneo/ember-browserify-issue/ test -- https://github.com/stephencattaneo/ember-browserify-issue/blob/master/tests/acceptance/root-test.js

mani-mishra commented 7 years ago

Hey, we are having the same issues. Any update on this?

stephencattaneo commented 7 years ago

Ended up doing import fetchMock from 'npm:fetch-mock/es5/server'; which seem to have work. I don't really know if thats how ember-browserify is suppose to work shrug

matthewbortolin commented 7 years ago

@stephencattaneo I'm having the same problem with a different repo

brancusi commented 7 years ago

Getting this as well now.

denchen commented 7 years ago

I'm not sure if this is the same problem, but I can't import deepmerge via ember-browserify.

I'm using:

When I have the following line in one of my services:

import deepmerge from 'npm:deepmerge';

I get:

ember.debug.js:19811 Error: Could not find module `npm:deepmerge` imported from `my-app/pods/authentication/service`

Is there any sort of workaround I can do in this instance?

oskarrough commented 7 years ago

It is probably this? https://github.com/ef4/ember-browserify/issues/14

As a workaround, import the same module from somewhere in app/ and the import from test/ will work.

iamdtang commented 7 years ago

@oskarrough I wonder if doing that will result in that test code and those dependencies being in your final build.

oskarrough commented 7 years ago

@skaterdav85 it will. Well not the test code, but the module you imported via app will.

iamdtang commented 7 years ago

@oskarrough along with that test's dependencies like ember-qunit.

oskarrough commented 7 years ago

@skaterdav85 oh you're right. OK, guess it's not a workaround afterall. Thanks!

NivBraz commented 4 years ago

still having that issue - ember cannot find 'fetch-mock'. im using ember 2.4 node: 6.14.4 trying fetch-mock in latest version - 9.3.0 and older one (7.7.3)