Add audio file in ReactPWA
NimaKaviyani opened this issue · 1 comments
NimaKaviyani commented
I want to use the mp3 file in the project. But when I import the file I get the following error:
ERROR in ./src/resources/sound/alarm.mp3 1:0
Module parse failed: Unexpected character '�' (1:0)
I know this code can resolve the problem:
webpack(config, options) {
config.module.rules.push(
{
test: /\.(mp3)/,
loader: "file-loader",
},
);
return config
}
But how and where can I use webpack config for this file?
tirthbodawala commented
Hi, @NimaKaviyani apologies for the late reply, you can create a local plugin for your webpack configuration for more reference to webpack plugin check the plugin already created here:
https://github.com/Atyantik/pawjs/tree/master/packages/pawjs-image-optimizer
Filename: https://github.com/Atyantik/pawjs/blob/master/packages/pawjs-image-optimizer/webpack.js