Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

could not find module chai (new module unification) #37

Closed
ghost opened this issue Sep 25, 2017 · 7 comments
Closed

could not find module chai (new module unification) #37

ghost opened this issue Sep 25, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Sep 25, 2017

I started migrating our app using https://github.com/rwjblue/ember-module-migrator/ and the https://github.com/emberjs/ember-module-unification-blueprint. The app builds successfully, but fails to load from the following error:
screen shot 2017-09-25 at 8 37 27 am
The import lines in that test file are:

import { expect } from 'chai';
import { describe, it, beforeEach } from 'mocha';
import Ember from 'ember';
import { initialize } from "web-server/src/init/initializers/application/initializer";
import destroyApp from 'web-server/tests/helpers/destroy-app';
import sinon from 'npm:sinon';
$ npm ls chai
└─┬ ember-cli-chai@0.4.2
  └── chai@3.5.0 

Our project's vendor.js does not appear to have chai loaded. This is a private repo but I am happy to test it / move this issue to a more relevant location.

@Turbo87
Copy link
Member

Turbo87 commented Sep 25, 2017

@rwjblue @mixonic any ideas?

@mixonic
Copy link
Member

mixonic commented Sep 25, 2017

@efx I'm surprised moving to module unification would break this kind of import. Scanning the code chai should be in the vendor tree. If it was exposing the library via the app/ directory I would expect issues, but on the surface this looks fine.

I think this simply needs to be debugged. I don't see anything in that index.js that seems coupled to the app/ tree.

@ghost
Copy link
Author

ghost commented Sep 25, 2017

thanks folks. ah, interesting @mixonic. I can hop on ember slack for quicker back and forth then post conclusion here.

@ghost
Copy link
Author

ghost commented Sep 25, 2017

I was mistaken about not being included in the app. Chai does appear in dist/assets/test-support.js. I was thinking it should appear in vendor.js. I'll look at the require there;
...
I'm somewhat confused as this error occurs navigating to http://localhost:4200/ from ember serve. Double checking I installed the correct versions of resolve, etc

@ghost
Copy link
Author

ghost commented Oct 2, 2017

Turns out runningember build builds the app with module resolutions for tests. e.g. ember-test and all our application test files. This seems incorrect. It also seems like a resolver issue, not an ember-cli-chai. Open to direction on where to move this, ideas about useful further debugging.

@ghost
Copy link
Author

ghost commented Dec 18, 2017

Removing the test files fromsrc/initializers tree prevents this specific error from appearing. So it seems the -test files are not being excluded properly with ember build. This may relate to ember-cli/ember-load-initializers#42.

@ghost
Copy link
Author

ghost commented Dec 19, 2017

I'm closing this because the underlying issue appears caused by the initializer loading.

@ghost ghost closed this as completed Dec 19, 2017
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants