Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NW configuration for Ember 1.13.x #38

Merged
merged 1 commit into from
Jul 24, 2015
Merged

Fix NW configuration for Ember 1.13.x #38

merged 1 commit into from
Jul 24, 2015

Conversation

brzpegasus
Copy link
Owner

Ember 1.13.x checks for the existence of process to determine if it is running in Node (probably for Fastboot). This can result in errors trying to load an Ember app in NW.js.

Changes:

  • The shim script will now delete window.process then restore it at the end.
  • Restoring NW.js variables on the window load event would not guarantee to run when it should. The shim is now split between 2 scripts: shim-head.js and shim-footer.js, both of which are injected into the page via the contentFor hooks.
  • The vendor/node-webkit/*.js blueprint files are no longer necessary and have been removed.
  • The reload.js file was moved from the blueprint to the addon's client/node-webkit/ folder and will be managed entirely by the addon itself. The consuming app won't have a copy of it laying around.
  • The addon now sets a process.env.EMBER_CLI_NW = true for all of its commands. This ensures that custom build steps only execute for the correct environment.

Ember 1.13.x checks for the existence of `process` to determine if it is running in Node (probably for Fastboot). This can result in errors trying to load an Ember app in NW.js.

Changes:

* The shim script will now delete `window.process` then restore it at the end.
* Restoring NW.js variables on the window `load` event would not guarantee to run when it should. The shim is now split between 2 scripts: `shim-head.js` and `shim-footer.js`, both of which are injected into the page via the `contentFor` hooks.
* The `vendor/node-webkit/*.js` blueprint files are no longer necessary and have been removed.
* The `reload.js` file was moved from the blueprint to the addon's `client/node-webkit/` folder and will be managed entirely by the addon itself. The consuming app won't have a copy of it laying around.
* The addon now sets a `process.env.EMBER_CLI_NW = true` for all of its commands. This ensures that custom build steps only execute for the correct environment.
brzpegasus added a commit that referenced this pull request Jul 24, 2015
Fix NW configuration for Ember 1.13.x
@brzpegasus brzpegasus merged commit d51b2b5 into master Jul 24, 2015
@brzpegasus brzpegasus deleted the nw-shim-fix branch July 24, 2015 22:45
@rwjblue
Copy link

rwjblue commented Jul 24, 2015

I'd kinda like to fix this in Ember itself also. I believe there is an open issue in the Ember repo for it (can't recall from whom though).

@brzpegasus
Copy link
Owner Author

@rwjblue Ah, yes, it must be this issue. Having it fixed in Ember would definitely be great. I wonder if in addition to verifying that process exists, we should also verify that window does not, before concluding we're in Node.

@rwjblue
Copy link

rwjblue commented Jul 25, 2015

Sounds great, would you mind testing that out locally and submitting a pull request to Ember?

@brzpegasus
Copy link
Owner Author

👍

@brzpegasus
Copy link
Owner Author

Pull requests that address this issue:

@brzpegasus brzpegasus mentioned this pull request Jul 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants