Closed HonzaTuron closed 2 years ago
This problem looks a bit complicated, and I haven't used next.js for a year, so see if you can solve it yourself?
Were you able to solve this ? I am facing the same error but with another lib (leaflet react)
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```
@poka93 I was able to fix it in next.config.js via this rule for png images (I'm using webpack5):
config.module.rules.push(
{
test: /\.png/i,
type: 'asset/resource',
generator: { publicPath: '/', filename: '[name][ext]' },
}
I did this and it is working. I don't know why honestly 😅
webpack: (config) => {
config.module.rules.push(
{
test: /\.(png|jpg|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 25000,
name: '[name].[hash:7].[ext]'
}
}
]
}
)
return config;
}
Hello,
my next.config looks like this:
And
next dev
works as expected.But when I run
next build
, it fails and informs me that I have no css loader - css file from external library can't be loaded:I would say css is bundled in next.js itself. Or am I wrong?
My dependencies: