fix: resolve paths in prebuild.js script (#5498)
This commit is contained in:
parent
3d5356cb8e
commit
e7d34677c6
@ -1,11 +1,12 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
// for development purposes we want to have the service-worker.js file
|
// 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
|
// accessible from the public folder. On build though, we need to compile it
|
||||||
// and CRA expects that file to be in src/ folder.
|
// and CRA expects that file to be in src/ folder.
|
||||||
const moveServiceWorkerScript = () => {
|
const moveServiceWorkerScript = () => {
|
||||||
const oldPath = "./public/service-worker.js";
|
const oldPath = path.resolve(__dirname, "../public/service-worker.js");
|
||||||
const newPath = "./src/service-worker.js";
|
const newPath = path.resolve(__dirname, "../src/service-worker.js");
|
||||||
|
|
||||||
fs.rename(oldPath, newPath, (error) => {
|
fs.rename(oldPath, newPath, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user