Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use Node.js functions when bundling for the browser #67

Merged
merged 1 commit into from Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/babel-helper-define-polyfill-provider/package.json
Expand Up @@ -16,7 +16,8 @@
},
"main": "lib/index.js",
"browser": {
"./lib/config/loader.js": "./lib/config/loader-browser.js"
"./lib/node/dependencies.js": "./lib/browser/dependencies.js",
"./src/node/dependencies.js": "./src/browser/dependencies.js"
},
"dependencies": {
"@babel/helper-compilation-targets": "^7.13.0",
Expand Down
@@ -0,0 +1,24 @@
// @flow

export function resolve(
dirname: string,
moduleName: string,
absoluteImports: boolean | string,
): string {
if (absoluteImports === false) return moduleName;

throw new Error(
`"absoluteImports" is not supported in bundles prepared for the browser.`,
);
}

// eslint-disable-next-line no-unused-vars
export function has(basedir: string, name: string) {
return true;
}

// eslint-disable-next-line no-unused-vars
export function logMissing(missingDeps: Set<string>) {}

// eslint-disable-next-line no-unused-vars
export function laterLogMissing(missingDeps: Set<string>) {}
Expand Up @@ -30,7 +30,7 @@ import type {
} from "./types";

import * as v from "./visitors";
import * as deps from "./dependencies";
import * as deps from "./node/dependencies";

import createMetaResolver from "./meta-resolver";

Expand Down