esbuild-plugins-node-modules-polyfill
Advanced tools
Comparing version 1.4.1-next.6e2ba6b.0 to 1.4.1-next.6e84c9b.0
@@ -5,4 +5,4 @@ 'use strict'; | ||
var path = require('path'); | ||
var localPkg = require('local-pkg'); | ||
var esbuild = require('esbuild'); | ||
var localPkg = require('local-pkg'); | ||
var resolve_exports = require('resolve.exports'); | ||
@@ -158,3 +158,2 @@ | ||
const resolver = /* @__PURE__ */ __name(async (args) => { | ||
const moduleName = normalizeNodeBuiltinPath(args.path); | ||
const emptyResult = { | ||
@@ -165,2 +164,9 @@ namespace: emptyNamespace, | ||
}; | ||
if (initialOptions.platform === "browser") { | ||
const packageJson = await localPkg.loadPackageJSON(args.resolveDir); | ||
const browserFieldValue = packageJson?.browser?.[args.path]; | ||
if (browserFieldValue !== void 0) | ||
return; | ||
} | ||
const moduleName = normalizeNodeBuiltinPath(args.path); | ||
const fallbackResult = fallback === "empty" ? emptyResult : void 0; | ||
@@ -167,0 +173,0 @@ if (!modules[moduleName]) { |
{ | ||
"name": "esbuild-plugins-node-modules-polyfill", | ||
"version": "1.4.1-next.6e2ba6b.0", | ||
"version": "1.4.1-next.6e84c9b.0", | ||
"description": "Polyfills nodejs builtin modules and globals for the browser.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -22,2 +22,3 @@ <div align="center"> | ||
- Supports `node:` protocol | ||
- Supports [`browser` field in `package.json`](https://github.com/defunctzombie/package-browser-field-spec) | ||
- Optionally injects globals | ||
@@ -24,0 +25,0 @@ - Optionally provides empty fallbacks |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37188
216
114