Require erroring if ember app is hosted by atom-shell application


#1

Hey there,

I’m trying to run an ember app inside an atom-shell frame.
Outside in regular browserland, everything works fine, inside atom-shell however, I’m getting

Uncaught Error: Could not find module jquery
Uncaught Error: Could not find module ember

I have previously used node-webkit which addresses potential problems which could occur due to a naming conflict of the node-require method and reqire.js’ require method. I’ve tried the suggested code snippet to no avail, and I don’t think it’s the solution to this anyway, since the error is occuring inside the vendor’d require method.

During debugging I noticed that the ‘ember’ module is present when the ‘jquery’ require fails, and the app modules are present during the ‘ember’ module load, but ember is not for some reason.

Not entirely sure how to continue solving this… it works as expected inside node-webkit with the suggested fix applied by the way, just not in atom-shell.


#2

+1

Would like to know this as well :smile:


#3

Solved by zcbenz over at atom/atom-shell.

You also need to set window.module to undefined.

That’s it!


#4

And where do you set that? I’ve tried both main.js in the Atom-shell part and app/app.js in the Ember part, but neither seems to do the trick :frowning:


#5

Adding this snippet before any other scripts in index.html works for me:

<script>
  // make it work inside atom-shell
  window.requireNode = window.require;
  window.require = undefined;
  window.module = undefined;
</script>