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

The library cannot be minified and used in the browser #13

Closed
jdrew1303 opened this issue Dec 2, 2016 · 6 comments
Closed

The library cannot be minified and used in the browser #13

jdrew1303 opened this issue Dec 2, 2016 · 6 comments
Assignees

Comments

@jdrew1303
Copy link

The use of pkginfo is preventing the api from being used by applications that run in the browser. A simple way of fixing this it to require the package.json directly and using that to pull info from. Then when browserify or webpack encounter the require they will import it as expected.

image

@jdrew1303
Copy link
Author

jdrew1303 commented Dec 2, 2016

For more info on why Im using it in the browser: Im using it in a Chrome Extension to allow a user to post github issues to Upwork as a job:

the_library_cannot_be_minified_and_used_in_the_browser_ _issue__13_ _upwork_node-upwork

I'm trying to avoid the use of a server if at all possible (I don't want to store credentials for Upwork as it links to peoples credit cards/ bank accounts, etc). I'd also prefer to use an official client library rather than my own home rolled one (usually have better support for newer apis, etc).

The other alternative is that I make the modifications necessary to support this and issue a pull request if you're ok with that?

@mnovozhylov
Copy link
Contributor

the library was developed as a backend one

@giorgio-zamparelli
Copy link

giorgio-zamparelli commented Jun 25, 2019

Hi there, pkginfo is also crashing our backend build with webpack.
Webpack does not pack the node-upwork/package.json inside the backend bundle and then pckinfo will throw the error "Could not find package.json".
You could just require the package.json in your code and get the version attribute from it without using pkginfo.

const packageJson = require('./package.json')
const version = packageJson.version

@mnovozhylov
Copy link
Contributor

We will take a closer look when it's possible. There is no ETA for this.

@mnovozhylov mnovozhylov reopened this Jul 1, 2019
@jdrew1303
Copy link
Author

@giorgio-zamparelli its easier to just fork it, make your changes and publish your own version. 👍 Thats what I did, works like a charm.

@mnovozhylov mnovozhylov self-assigned this Jul 25, 2019
mnovozhylov added a commit that referenced this issue Jul 25, 2019
- Update lodash dependency to >=4.17.13 (secufity fix)
- Fix GitHub issue #13
@mnovozhylov mnovozhylov mentioned this issue Jul 25, 2019
@mnovozhylov
Copy link
Contributor

Fixed in v1.3.2

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