You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
706 B
21 lines
706 B
const fs = require("fs"); |
|
const path = require("path"); |
|
|
|
// for development purposes we want to have the service-worker.js file |
|
// accessible from the public folder. On build though, we need to compile it |
|
// and CRA expects that file to be in src/ folder. |
|
const moveServiceWorkerScript = () => { |
|
const oldPath = path.resolve(__dirname, "../public/service-worker.js"); |
|
const newPath = path.resolve(__dirname, "../src/service-worker.js"); |
|
|
|
fs.rename(oldPath, newPath, (error) => { |
|
if (error) { |
|
throw error; |
|
} |
|
console.info("public/service-worker.js moved to src/"); |
|
}); |
|
}; |
|
|
|
// ----------------------------------------------------------------------------- |
|
|
|
moveServiceWorkerScript();
|
|
|