Open isaced opened 6 months ago
Check your node_modules/lz4/build/Release
folder. You should see an lz4.node
and xxhash.node
file in there. If not, try re-running npm install
or yarn install
.
You'll need to make sure whatever is running the environment recognizes those files as modules. For example, with jest you have to add node
to the moduleFileExtensions
list.
Y'all ever get any further with this? @RoboCafaz, @isaced struggling with the same issue. I even tried wrapping some of the stuff manually and had no luck.
@Tukajo you can try this:
const nextConfig = {
output: "standalone",
experimental: {
serverComponentsExternalPackages: ["lz4"], // <-add this
},
};
export default nextConfig;
@isaced thanks for the suggestion! I should have been more clear 🙂.
I'm actually just using a regular nodejs env. Trying to basically bundle an aws lambda. So no nextjs involved unfortunately.
@isaced thanks for the suggestion! I should have been more clear 🙂.
I'm actually just using a regular nodejs env. Trying to basically bundle an aws lambda. So no nextjs involved unfortunately.
@Tukajo any luck with solving this? i am having the same issue on lambda
@Andriy-Kulak I went down a deep deep rabbithole that lead me to a circular series of threads where people were in a stalemate on resolving this.
Some folks were essentially arguing that this will not be implemented, since the new node fetch does not resolve local file URIs anymore as of the latest node versions. They refused to do it because various fetch specs from WinterCG specify that "file resolving" is left up to the reader as exercise see: https://fetch.spec.wintercg.org/
I don't personally agree with this argument all that much since honestly it is surprising to me that node would allow file fetching up until now and basically break a ton of functionality. I don't know who's "problem" this is to fix.
Since there is this stalemate, and lz4 mostly relies on fetch resolving local wasm files for lz4, I don't foresee any fix any time soon.
I moved on to using different compression algorithms for my work that did not rely on local file fetching, or had out-of-the-box support for file fetching.
My use-case was identical to yours, this was lambda code.
Sorry I couldn't help more.
ENV: