zino
zino

Reputation: 1612

Why does Browserify include package.json for some NPM packages?

enter image description here

Im using gulp and browserify to create a single bundle js file, but for a few packages their package.json along with full local file paths is included in the final file. Why is this?

I have "fullPaths: false" set for browserify in my gulp task.

My package.json (for gulp):

"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babelify": "^7.3.0",
"browserify": "^13.1.0"

Thanks

Upvotes: 1

Views: 367

Answers (1)

cartant
cartant

Reputation: 58400

The full paths are in the package.json. The full paths are there not because of Browserify, but because NPM adds them when the modules are installed.

The package.json file that's in the bundle appears to be for the useragent module and is included because that module has required it (i.e. require("./package.json")). It has done this to facilitate the reporting of the version that's specified in the package.json file.

You can see the require call here.

Upvotes: 2

Related Questions