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

Add support for "browser" field for jspm itself #1675

Closed
letmaik opened this Issue Apr 3, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@letmaik

letmaik commented Apr 3, 2016

As written in another issue jspm currently supports the "browser" field only for npm installs. I think it would be really useful to support this in jspm itself, especially when trying to make npm source repositories compatible to jspm.

In my case, I develop an npm package which uses transpilation and "browser". For development purposes it would be nice to be able to depend on that package as a normal github dependency from jspm. And the browser field support is the last missing piece for that: https://github.com/Reading-eScience-Centre/covjson-reader/blob/d21eaf68517881f7bcc17cf5c36388d089c08a56/package.json#L44 An alternative main entry point for jspm is really not a convenient solution here.

Is there any chance for adding such a feature? Or a good reason not to have it?

@guybedford

This comment has been minimized.

Show comment
Hide comment
@guybedford

guybedford Apr 29, 2016

Member

In jspm we encourage conditional package configuration over this existing browser convention. This can currently be done in jspm 0.17 with a package.json containing:

{
  "main": "index.js",
  "map": {
    "./index.js": {
      "browser": "./index-browser.js"
    }
  }
}
Member

guybedford commented Apr 29, 2016

In jspm we encourage conditional package configuration over this existing browser convention. This can currently be done in jspm 0.17 with a package.json containing:

{
  "main": "index.js",
  "map": {
    "./index.js": {
      "browser": "./index-browser.js"
    }
  }
}

@guybedford guybedford closed this Apr 29, 2016

@letmaik

This comment has been minimized.

Show comment
Hide comment
@letmaik

letmaik Apr 29, 2016

What are the conditions exactly in general?

letmaik commented Apr 29, 2016

What are the conditions exactly in general?

@guybedford

This comment has been minimized.

Show comment
Hide comment
@guybedford

guybedford Apr 30, 2016

Member

Documentation is lacking but currently the core system conditions are browser, production and node. Custom conditions can be configured as well, although this is currently still an undocumented workflow for packages.

Member

guybedford commented Apr 30, 2016

Documentation is lacking but currently the core system conditions are browser, production and node. Custom conditions can be configured as well, although this is currently still an undocumented workflow for packages.

@letmaik

This comment has been minimized.

Show comment
Hide comment
@letmaik

letmaik May 1, 2016

Seems like production is a thing that could be combined with browser or node. How would that look like then? And what is it anyway? Is the "default" mode something like development?

letmaik commented May 1, 2016

Seems like production is a thing that could be combined with browser or node. How would that look like then? And what is it anyway? Is the "default" mode something like development?

@guybedford

This comment has been minimized.

Show comment
Hide comment
@guybedford

guybedford May 2, 2016

Member

jspm bundle and bulid will by default bundle for the browser in production. This can be altered by providing the --node or --dev flags to the build commands. SystemJS builder allows fine-grained setting of conditions though.

Member

guybedford commented May 2, 2016

jspm bundle and bulid will by default bundle for the browser in production. This can be altered by providing the --node or --dev flags to the build commands. SystemJS builder allows fine-grained setting of conditions though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment