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

browser field for package.json #49

Closed
wants to merge 1 commit into from

Conversation

defunctzombie
Copy link

When packaging this module for client side delivery, the browser field
in package.json provides a hint to the package tool about which files to
replace with client targeted counterparts.

This is currently supported by the following bundle tool:
https://github.com/shtylman/node-script

And I hope to get wider adoption of this practice. The goal is to provide a sensible way for module authors to make their packages cross environment. npm modules have the cool property of being able to work in server and client environments and this eases the burden on consumers of your module (like engine.io). Since your module aims to replicate the browser side api on the server, the browser portion simply provides the xml request object.

When packaging this module for client side delivery, the browser field
in package.json provides a hint to the package tool about which files to
replace with client targeted counterparts.
@defunctzombie
Copy link
Author

Any comment on this? I submitted a similar patch to the 'ws' module websockets/ws@f7eb821 so it could be used when making client side packages.

@defunctzombie
Copy link
Author

If you do decide to merge this, use the following commit instead:
defunctzombie@c7b444e

@defunctzombie
Copy link
Author

Any update on this issue?

@defunctzombie
Copy link
Author

bump. If you don't want to accept this, please let me know and I will just stop checking in on it :)

@defunctzombie
Copy link
Author

Are you no longer maintaining this project? There has been no activity for a while or response to the issues.

@driverdan
Copy link
Owner

I haven't worked on it in a while but I don't consider it dead. I'll work
through the open issues this weekend.

On Thu, Feb 28, 2013 at 1:38 PM, Roman Shtylman notifications@github.comwrote:

Are you no longer maintaining this project? There has been no activity for
a while or response to the issues.


Reply to this email directly or view it on GitHubhttps://github.com//pull/49#issuecomment-14252790
.

@@ -24,4 +24,7 @@
, "example": "./example"
}
, "main": "./lib/XMLHttpRequest.js"
, "browser": {
"./lib/XMLHttpRequest.js": "./lib/browser.js"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to define a file mapping, if you define the path of the browser-specific file, it will be used as entry point instead of the one for Node.js defined on "main", so this can be just "browser": "./lib/browser.js".

@piranna
Copy link

piranna commented Nov 2, 2013

Why did you closed the pull request? Is there any other way I can get this to be integrated?

@defunctzombie
Copy link
Author

I am no longer interested in this pull request. I needed it for engine.io-client to work with browserify. For that I am working with engine.io-client maintainers directly (since they have forked this repo) and have a simpler patch in my engine.io-client repo to make it browserify compatible.

socketio/engine.io-client#200

@piranna
Copy link

piranna commented Nov 2, 2013

I see, it makes sense. I was interested on it for my job, maybe I'll need to find a solution in other place then... :-)

@piranna piranna mentioned this pull request Nov 3, 2013
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.

3 participants