How To Include A Script Into My Build Folder Separately?
I am working on a Chrome extension that requires a background script (background.js). Currently when I npm run build, the project is built as normal in the build folder. I then cop
Solution 1:
You could add the script to the public
folder and add this line to your index.html
file:
<script src="%PUBLIC_URL%/background.js"></script>
Solution 2:
You can eject your app:
npm run eject
and then in package.json under scripts change:
"build": "node scripts/build.js
to
"build": "node scripts/build.js && cp background.js build/background.js"
Post a Comment for "How To Include A Script Into My Build Folder Separately?"