You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tests: Module not found: Error: Can't resolve 'meteor/meteor' #2
In an attempt to write a karma test in the angularcli-meteor template, I added a test case, which depends on Meteor by importing 'meteor/meteor' in a class under test.
Then, if I issue $> npm run test
I get Module not found: Error: Can't resolve 'meteor/meteor'
To easily reproduce the issue, modify app.component.ts by calling anything on Meteor. E.g.
Having read angular/angular-cli#8086 I can see that the issue is about Uncaught ReferenceError: Mongo is not defined.
I was able to overcome this by importing 'meteor-client' in test.ts.
I suspect that the issue I reported may have a different cause.
I've resolved the build error by doing npm install meteor-client
But now i'm getting:
vendor.bundle.js:67016 Uncaught ReferenceError: Mongo is not defined
at new Collection (vendor.bundle.js:67016)
at Object../api/server/collections/chats.ts (main.bundle.js:10)
at __webpack_require__ (inline.bundle.js:55)
at Object../api/server/collections/index.ts (main.bundle.js:19)
at __webpack_require__ (inline.bundle.js:55)
at Object../src/app/app.component.ts (main.bundle.js:89)
at __webpack_require__ (inline.bundle.js:55)
at Object../src/app/app.module.ts (main.bundle.js:133)
at __webpack_require__ (inline.bundle.js:55)
at Object../src/main.ts (main.bundle.js:191)
I'm running into the same error. Is there a solution or workaround, yet?
Edit: I experience the error Error: Module not found: Error: Can't resolve 'meteor/meteor' as described above. I also experience this issue on a fresh clone of this repo. And I'm a little confused, that it seems to work for @michaelb-01 ?!
Activity
darkbasic commentedon Oct 18, 2017
angular/angular-cli#8086
Unfortunately this is a known issue with no solution yet. It seems that webpack does not honour
externalswhen running tests.rgal75 commentedon Oct 18, 2017
Having read angular/angular-cli#8086 I can see that the issue is about
Uncaught ReferenceError: Mongo is not defined.I was able to overcome this by importing
'meteor-client'intest.ts.I suspect that the issue I reported may have a different cause.
rgal75 commentedon Oct 19, 2017
It looks to me that Karma is still using AngularCli to build the tests instead of the ejected and modified
webpack.configthat has theconfiguration and as a result the tests cannot see the
meteor/*modules.What do you think?
darkbasic commentedon Oct 19, 2017
I'm not sure, but the Mongo error was definitely an oversight from my side.
michaelb-01 commentedon Nov 16, 2017
I'm getting the same error (though main.ts now has import 'meteor-client';)
michaelb-01 commentedon Nov 16, 2017
I've resolved the build error by doing npm install meteor-client
But now i'm getting:
darkbasic commentedon Nov 16, 2017
Did you run
npm run meteor-client:bundle?michaelb-01 commentedon Nov 16, 2017
Sorry no I hand't, ignore me! It works now!
janKir commentedon Feb 19, 2018
I'm running into the same error. Is there a solution or workaround, yet?
Edit: I experience the error
Error: Module not found: Error: Can't resolve 'meteor/meteor'as described above. I also experience this issue on a fresh clone of this repo. And I'm a little confused, that it seems to work for @michaelb-01 ?!