I want to modify the sources from .js and add it to my project.
I downloaded .js sources, made a few changes and ran npm run build. Then i took the hls.js file from the /dist dir, and tried to add it to my react node project. Created a "local_modules" dir in in the root folder of the project and pasted the hls.js file there. Then added in package.json the dependency: "hls.js": "file:/local_modules/hls.js" and ran npm install. From my react component i imported: import Hls from "hls.js"; And i keep getting the error module not found.
If i place the hls.js file in a folder inside src and import Hls from there it kind of works with several errors.
What is the right way of doing this?
I want to modify the sources from https://github/video-dev/hls.js and add it to my project.
I downloaded https://github/video-dev/hls.js sources, made a few changes and ran npm run build. Then i took the hls.js file from the /dist dir, and tried to add it to my react node project. Created a "local_modules" dir in in the root folder of the project and pasted the hls.js file there. Then added in package.json the dependency: "hls.js": "file:/local_modules/hls.js" and ran npm install. From my react component i imported: import Hls from "hls.js"; And i keep getting the error module not found.
If i place the hls.js file in a folder inside src and import Hls from there it kind of works with several errors.
What is the right way of doing this?
Share Improve this question asked Mar 19 at 16:11 rainwizrainwiz 11 Answer
Reset to default -1If you are putting the file in a directory inside your project, then it isn't a dependency. It is part of your project. It shouldn't be recorded as a dependency.
If you wanted to use it as a dependency, then you'd need to state the location of the project you are importing from.
"hls.js": "file:///Users/Bob/projects/hls.js"