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

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

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

Comments

@gravsten
Copy link

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
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Collaborator

Example package: https://github.com/mzabriskie/axios

@Deterus
Copy link

Deterus commented Sep 5, 2018

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

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

No branches or pull requests

3 participants