felicity-lims/frontend/vite/scripts/patch1.js
2021-01-21 21:38:17 +02:00

29 lines
No EOL
692 B
JavaScript

const fs = require("fs");
const path = require("path");
const loadTrackingPath = path.resolve(
__dirname,
"../node_modules/@vue/apollo-composable/dist/util/loadingTracking.js"
);
fs.rmdirSync(path.resolve(__dirname, "../node_modules/.vite_opt_cache"), {
recursive: true
});
fs.writeFileSync(
loadTrackingPath,
fs.readFileSync(loadTrackingPath, "utf8").replace(/\.\$root/m, ".root")
);
const useQueryPath = path.resolve(
__dirname,
"../node_modules/@vue/apollo-composable/dist/useQuery.js"
);
fs.writeFileSync(
useQueryPath,
fs
.readFileSync(useQueryPath, "utf8")
.replace(/\:\sonServerPrefetch\(/, ": (() => {})(")
.replace(/(.* require\("vue"\);)/m, "")
);