question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't resolve node builtin modules in esm build dependency

See original GitHub issue

Bug report

What is the current behavior?

<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'url' in '/Users/keenwon/Test/webpack-test'
<w> while resolving 'url' in /Users/keenwon/Test/webpack-test as file
<w>  at resolve esm file url
<w>  at file dependencies /Users/keenwon/Test/webpack-test/webpack.config.mjs
<w>  at file /Users/keenwon/Test/webpack-test/webpack.config.mjs
<w>  at resolve commonjs /Users/keenwon/Test/webpack-test/webpack.config.mjs

If the current behavior is a bug, please provide the steps to reproduce.

works fine, no warnings

What is the expected behavior?

Other relevant information: webpack version: 5.70.0 Node.js version: v14.19.0 Operating System: macOS 12.3 Additional tools:

demo

repo https://github.com/keenwon/webpack-test, switch to node-prefix branch

image

node: doesn’t work either

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
vankopcommented, Mar 23, 2022

I found a problem… For now I can suggest to use commonjs config format…

0reactions
vankopcommented, Aug 2, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

esbuild cannot resolve node built-in modules starting with `_`
When I try to bundle a file that imports _http_common , which is a Node built-in module, esbuild throws an error Could not...
Read more >
esbuild cannot resolve the Node.js module 'events'
I discovered this issue when searching around, but the offending line is in a dependency, so I cannot simply edit its source to...
Read more >
Getting Started - ESBuild
Getting Started. #Install esbuild. First, download and install the esbuild command locally. A prebuilt native executable can be installed using npm (which ...
Read more >
rollup.js
To make sure your ES modules are immediately usable by tools that work with CommonJS such as Node.js and webpack, you can use...
Read more >
esbuild-node-externals - npm
Start using esbuild-node-externals in your project by running `npm i esbuild-node-externals`. There are 49 other projects in the npm ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found