So this just caused me major headache: if you have global-style active in your npmrc, browserify won't find dependencies of your dependencies.
It would be very helpful if browserify were able to locate these modules even if they are in subdirectories of node_modules. At the very least, a warning would be immensely helpful (perhaps at package install time) if global-style is set.
Another idea is to check package-lock.json. It seems to keep track of if global-style is being used, so checking it could either be used to generate a warning, or to resolve the actual location of a dependency.
To reproduce this issue, simply create a package with the following package.json:
{
"name": "global-styles-issue",
"version": "1.0.0",
"private": true,
"browserify": {
"transform": [
"babelify"
]
},
"dependencies": {
"@babel/core": "^7.0.1",
"babelify": "^10.0.0",
"browserify": "^16.2.2"
}
}
.. and then create a JS file with:
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const browserify = require('browserify');
const testFile = path.resolve(__dirname, 'test.js');
let fd = fs.openSync(testFile, 'a');
fs.closeSync(fd);
browserify(testFile).bundle()
Finally, run npm i only after turning global-styles on.
So this just caused me major headache: if you have
global-styleactive in yournpmrc,browserifywon't find dependencies of your dependencies.It would be very helpful if
browserifywere able to locate these modules even if they are in subdirectories ofnode_modules. At the very least, a warning would be immensely helpful (perhaps at package install time) ifglobal-styleis set.Another idea is to check
package-lock.json. It seems to keep track of ifglobal-styleis being used, so checking it could either be used to generate a warning, or to resolve the actual location of a dependency.To reproduce this issue, simply create a package with the following
package.json:{ "name": "global-styles-issue", "version": "1.0.0", "private": true, "browserify": { "transform": [ "babelify" ] }, "dependencies": { "@babel/core": "^7.0.1", "babelify": "^10.0.0", "browserify": "^16.2.2" } }.. and then create a JS file with:
Finally, run
npm ionly after turningglobal-styleson.