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

failure to handle the "browser" field in dependencies' package.json #581

Open
gravsten opened this Issue Apr 2, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@gravsten

gravsten commented Apr 2, 2017

I'm submitting a bug report

  • Library Version:
    0.27.0

Please tell us about your environment:

  • Operating System:
    Windows 8.1

  • Node Version:
    6.10.0

  • NPM Version:
    3.10.10

Current behavior:
Several libs show a "browser" field in their package.json, which can be of several forms :

  1. alternative "main", e.g. "index-browser"
  2. arguments, e.g. leveldown = false

aurelia-cli ignores this information, thus requiring the same dependencies as the node version... which inevitably fails.
As a result, users have to edit aurelia.json to add a "main" section, or worse edit the library to hard-code any arguments that change its behaviour for the browser.

Expected/desired behavior:
The "browser" section of package.json should be taken into account when loading and tracing a dependency module.

  • What is the motivation / use case for changing the behavior?
    Make the inclusion of certain libraries (e.g. pouchdb-adapter-memory) seamless, save the developers' time, and more importantly bring peace and happiness among all nations and people.
@gravsten

This comment has been minimized.

Show comment
Hide comment
@gravsten

gravsten Apr 4, 2017

About 10% of the dependencies in a typical setup, and
exactly 5,7% of the dependencies in the base Aurelia project created with 'au new' and the TypeScript option, present a "browser" section in their package.json

aurelia-cli 0.27.0 fails to handle the "browser" section and, considering the above, this post is more like a bug report than an enhancement request.

gravsten commented Apr 4, 2017

About 10% of the dependencies in a typical setup, and
exactly 5,7% of the dependencies in the base Aurelia project created with 'au new' and the TypeScript option, present a "browser" section in their package.json

aurelia-cli 0.27.0 fails to handle the "browser" section and, considering the above, this post is more like a bug report than an enhancement request.

@JeroenVinke

This comment has been minimized.

Show comment
Hide comment
@JeroenVinke

JeroenVinke Apr 4, 2017

Member

Thanks for opening these issues, all of them should be supported by the CLI. Just because they are flagged as enhancements, does not necessarily mean that they do not take priority over issues flagged as bugs. In fact, improving the bundler is a priority of mine, and the issues you've opened will help a lot, so thanks!

Member

JeroenVinke commented Apr 4, 2017

Thanks for opening these issues, all of them should be supported by the CLI. Just because they are flagged as enhancements, does not necessarily mean that they do not take priority over issues flagged as bugs. In fact, improving the bundler is a priority of mine, and the issues you've opened will help a lot, so thanks!

@JeroenVinke

This comment has been minimized.

Show comment
Hide comment
@JeroenVinke
Member

JeroenVinke commented Apr 10, 2017

@Deterus

This comment has been minimized.

Show comment
Hide comment
@Deterus

Deterus Sep 5, 2018

Adding another example package in case multiple instances were useful. https://www.npmjs.com/package/uuid

Deterus commented Sep 5, 2018

Adding another example package in case multiple instances were useful. https://www.npmjs.com/package/uuid

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 6, 2018

feat: fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 6, 2018

feat: fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 13, 2018

feat: fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 14, 2018

feat(bundler): fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 14, 2018

feat(bundler): fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 25, 2018

feat(bundler): fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581

huochunpeng added a commit to huochunpeng/cli that referenced this issue Sep 27, 2018

feat(bundler): fully support package.json browser field
Support (1) alternative main, (2) replace specific files, (3) ignore a module.
Cleanup dependency string ending in '/' or '.js'.

closes aurelia#579, aurelia#581
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment