Skip to content

Incompatibility with global-style #151

Open
@mvastola

Description

@mvastola

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions