Skip to content

browser support - without bundler #175

Open
@Toxicable

Description

@Toxicable

(Thanks for reporting an issue to micromatch! If you haven't already read the contributor guidelines, Please do that now, then proceed to fill out the details below.)

Please describe the minimum necessary steps to reproduce this issue:

Bundle micromatch with the Angular CLI

What is happening that shouldn't be?

To best support browsers it's a good idea to not directly rely on nodejs.
So we could either directly remove dependencies on nodejs, or provide conditionals

What should be happening instead?

The libs are very close to supporting browser without any bundler intervention as it stands.
These are the few changes needed.

https://github.com/micromatch/picomatch/blob/master/lib/picomatch.js#L155
This could be replaced with an internal version of basename

https://github.com/micromatch/picomatch/blob/master/lib/utils.js#L3
This could be replaced with a browser check + conditional require

let path;
if(!isBrowser()) {
  path = require('path');
}

https://github.com/micromatch/picomatch/blob/master/lib/utils.js#L4
This could be replaced with

const win32 = !isBrowser() && process.platform === 'win32';

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