yarn && yarn start
- use cra start project
- import craco package
- use craco.config.js to modify webpack
module: {
rules: [
{
test: /\.mp3$/,
loader: 'file-loader',
query: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
},
- declare mp3 type on react-app-env.d.ts
declare module '*.mp3' {
const src: string
export default src
}
- easy use on any position~