-
Notifications
You must be signed in to change notification settings - Fork 59
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
resvg error(by Next.js 14) #315
Comments
You have to use https://www.npmjs.com/package/nextjs-node-loader/v/1.1.1 |
@mathiasprisfeldt do you have an example how you use it ? |
@udatny
// next.config.mjs
export default () => {
const nextConfig = {
webpack: (config) => {
config.module.rules.push(
{
test: /\.node$/,
use: [
{
loader: 'nextjs-node-loader',
},
],
},
);
return config;
}
};
return nextConfig;
}; |
you need to add const nextConfig = {
experimental: {
serverComponentsExternalPackages: ["@resvg/resvg-js"],
},
}; EDIT: const nextConfig = {
serverExternalPackages: ["@resvg/resvg-js"],
}; |
@joshxfi Your hint helped me solve a tricky issue. |
hi!
I wrote logic to convert svg to png using resvg in next.js, but the following error occurred. Could I possibly get some help?
⨯ ./node_modules/@resvg/resvg-js-win32-x64-msvc/resvgjs.win32-x64-msvc.node
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
Import trace for requested module:
./node_modules/@resvg/resvg-js-win32-x64-msvc/resvgjs.win32-x64-msvc.node
./node_modules/@resvg/resvg-js/js-binding.js
./node_modules/@resvg/resvg-js/index.js
./src/utils/svgToPngUtil.ts
./src/app/api/satori/route.tsx
○ Compiling /not-found ...
⨯ ./node_modules/@resvg/resvg-js-win32-x64-msvc/resvgjs.win32-x64-msvc.node
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
The text was updated successfully, but these errors were encountered: