question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

package.json is included in the build files

See original GitHub issue

Hi

I just noticed that your

lib\version.js file is looking for a version from package.json

module.exports = require('../package.json').version;

What this is doing internally, it exports all packege.json file as js module and adds it to the minified/uglified build.

So in my build, I got your whole package.json file with all dependencies and settings for no reason.

I also noticed that error with my build. I get around this by using node.env to pass it in like this:

version: process.env.VERSION

I do not know will this work for you but you will find a solution that fits your need.

Please modify this so your packege.json will not be added to any build that someone will make while using your library.

Regards

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17

github_iconTop GitHub Comments

3reactions
francoabaroacommented, Mar 15, 2019

@eloc3147 not sure if you’re still having this issue.

I ran into this also, and had to add a clean script in my package.json scripts section

"clean": "rm -rf node_modules/websocket/.git", "heroku-postbuild": "npm run clean && npm install --only=dev --no-shrinkwrap",

Not sure what side effects it will have (none yet). My build is completing successfully now.

0reactions
PMustardcommented, Jul 15, 2019

This is not a cosmetic change.

I see you’re not getting the problem with it. Some people really care about code size and security issues.

Cosmetic is the solution. But I do not know how to apply it to your code, cause I do not know it as you do.

So I do not understand why did you close this issue ?? It’s not done and it’s not cosmetic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

package.json - npm Docs
json which is a map of command name to local file name. When this package is installed globally, that file will be either...
Read more >
Javascript: is package.json dependency included in build, if ...
The package.json and the dev-dependencies are primarily about your module being installed by others, when you do not distribute a bundled ...
Read more >
The Basics of Package.json - NodeSource
The package.json file is core to the Node.js ecosystem and is a fundamental part of understanding and working with Node.js , npm ......
Read more >
A deep dive on the package.json file | Geek.I.Am
The package.json is one of the core components of the Node runtime environment, and it typically included in the project root directory of...
Read more >
Two package.json Structure - electron-builder
The package.json resides in the root of your project. Here you declare the dependencies for your development environment and build scripts ( devDependencies...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found