I'm using laravel-mix in Laravel8 to write react code and compile then.
In normal use everything is right. but when I want to load an mp4 file into react using line below:
require(`./files/${mp4file}`)
I receive this error for loading mp4
file during compile with laravel-mix by npm run dev
:
ERROR in ./resources/files/5.mp4 1:0
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)
webpack compiled with 1 error
NOTE: I have this program in create-react-app
and it works very well without no problem during build
and run
.
How can I fix this error?