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

Error resolving path when building bundle for browser with esbuild #268

Open
wch opened this issue May 23, 2022 · 0 comments
Open

Error resolving path when building bundle for browser with esbuild #268

wch opened this issue May 23, 2022 · 0 comments

Comments

@wch
Copy link

wch commented May 23, 2022

I may be missing something obvious, but when I use istextorbinary and build for the browser, I get the following error:

 > node_modules/istextorbinary/edition-browsers/index.js:2:26: error: Could not resolve "path" (use "platform: 'node'" when building for node)
    2 │ import * as pathUtil from 'path';
      ╵                           ~~~~~~

Should it be importing from path?

Here's an example file test.ts:

import { isText } from "istextorbinary";
isText("test");

And here's what happens if you try to build it with esbuild --bundle:

$ esbuild test.ts --outfile=test.js --bundle
 > node_modules/istextorbinary/edition-browsers/index.js:2:26: error: Could not resolve "path" (use "--platform=node" when building for node)
    2 │ import * as pathUtil from 'path';
      ╵                           ~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant