browserify / browserify/module-deps

Incompatibility with global-style

Open
#151 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
208
Forks
102
PR merge metrics
No merged PRs in 30d

Description

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`:
```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:
```js
#!/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.