Unexpected character '�' (1:0)
waseemhnyc opened this issue · comments
Waseem commented
Hey there! I am trying to use this package in a Next JS 13 app.
Currently getting the following error:
./node_modules/canvas/build/Release/canvas.node
Module parse failed: Unexpected character '�' (1:0)
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)
I tried creating a webpack.config.js
file and including a loader - but no luck.
Not sure exactly how to move forward from here.
Samuel Villegas commented
I came across the same issue how I fixed it was adding node-loader into the webpack config field inside next.config.js
. Here's what my config looks like.
const nextConfig = {
webpack: (config, options) => {
config.module.rules.push({
test: /\.node$/,
loader: "node-loader",
});
return config;
},
};