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
New node: scheme from Node 16 not handled #13290
Comments
Yep, we should improve this, you can help, here place https://github.com/webpack/webpack/blob/master/lib/node/NodeTargetPlugin.js |
Sure, opened a quick PR here: #13311 Asked for some feedback from you over there. |
So this feature is about to get more usage: the https://nodejs.org/api/esm.html -> link "node: Imports" (links with anchors don't scroll properly right now) |
An alternative to the approaches in #13311 and #12693 would be to use |
I can confirm this issue is still relevant. I'm getting the following error:
|
Fixed by #12693 |
Nice, really cool! Looking forward to using this! (also with our students in Next.js!) Will this be in a new patch ( |
@karlhorky I think we will have minor release in near future |
We want to finish some critical issues and support |
Oh nice!! I've seen that syntax floating around, wanting to try it for a while 🙌 |
I've requested that the compiled version of webpack be upgraded in Next.js too: vercel/next.js#26914 |
Using webpack 5.58.1 I'm still getting this error:
Does webpack need some kind of extra configuration to make |
why you close issues if not solved? |
You need to use |
If you provide example with the problem I will show you how to setup it |
here is my same failure. @alexander-akait can you explain what should be done with
|
Because they are URLs, so you need to use If you provide example I will show how to fix it |
I have this- it appears to compile?
|
Please use |
@alexander-akait this still doesn’t work in combination with |
You should not use |
@alexander-akait could you please add more info - I am using next.config.js, so the docs don't really tell me the correct syntax
|
If you need an empty module, you can use (works like externals: {
// You can use `false` or other values if you need something strange here,example will output `module.exports = {};`
"node:path": "{}",
}, If you need polyfill please you: plugins: [
new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
const mod = resource.request.replace(/^node:/, "");
switch (mod) {
case "path":
resource.request = "path-browserify";
break;
default:
throw new Error(`Not found ${mod}`);
}
}),
] |
For aliases we have an issue, but |
It seems like the compiled webpack version in Next.js 12.2.2 still doesn't support this, still getting the following error:
cc @sokra |
Edit: No longer needed as of Next.js v13.1.5 🎉Next.js v13.1.5 added support for the Workaround (
|
@karlhorky please use externals for this. e.g. your webpack config module.exports = {
externals: { "node:path": "commonjs path" }
}; |
I tried the |
@alexander-akait i am getting the error: when I try to work with the
These are my webpack configs:
webpack rules
Hope you (or anyone else) can help me out, since I am stuck for a while now 😅 |
Please use |
@alexander-akait do you have an example on him to add |
|
To circle back here, I've opened a PR to Next.js to support |
The PR above vercel/next.js#45149 by @timneutkens added support for the Also updated my workaround post above: #13290 (comment) |
Hey @colinrw I'd also just came across the same problem as you did, was wondering if you managed to solve the problem with adding externals to webpack.config? I tried doing it and managed to not get any error but when trying to run the Client, I get something that say "unexpected token : ..." |
Hey! I don't know why, but my project was not able to run lots of different internal API calls from different packages. I mainly had to use regular REST calls to make these calls. Therefor I was not able to solve this webpack issue. |
Yeah having the same problem as well.. will look into how to use REST then, thank you! |
Hi, i've implemented the fix for Module build failed: UnhandledSchemeError: Reading from "node:fs/promises" is not handled by plugins (Unhandled scheme).
But now i am getting does anyone have a clue why this is is happening? below is what is causing the issue inside the node_modules/langchain/dist/vectorstores/hnswlib.js
|
Bug report
What is the current behavior?
The new
node:
prefix from Node v16 causes anUnhandledSchemeError
:This will be backported to at least also Node v14
If the current behavior is a bug, please provide the steps to reproduce.
Minimal reproduction repo (run
yarn start
): https://github.com/karlhorky/webpack-node-16-schemaWhat is the expected behavior?
webpack should throw a "Module not found" error with the polyfills warning, just like when you
import path from 'path'
:Other relevant information:
webpack version: 5.36.2
Node.js version: 16.0.0
Operating System: macOS Big Sur 11.3
Additional tools:
The text was updated successfully, but these errors were encountered: