Merge branch 'ditorodev' of git.lumeweb.com:LumeWeb/web3browser.io into ditorodev
This commit is contained in:
commit
dd6869e6a5
|
@ -1,31 +1,32 @@
|
|||
import { defineConfig } from "astro/config";
|
||||
import { defineConfig } from 'astro/config'
|
||||
|
||||
import react from "@astrojs/react";
|
||||
import tailwind from "@astrojs/tailwind";
|
||||
import optimizer from "vite-plugin-optimizer";
|
||||
import * as fs from "node:fs";
|
||||
import react from '@astrojs/react'
|
||||
import tailwind from '@astrojs/tailwind'
|
||||
import optimizer from 'vite-plugin-optimizer'
|
||||
import * as fs from 'node:fs'
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
integrations: [react(), tailwind({ applyBaseStyles: false })],
|
||||
vite: {
|
||||
server:
|
||||
process.env.MODE === "development"
|
||||
? {
|
||||
https: {
|
||||
cert: fs.readFileSync("./.local-ssl/localhost.pem"),
|
||||
key: fs.readFileSync("./.local-ssl/localhost-key.pem"),
|
||||
},
|
||||
}
|
||||
: {},
|
||||
build: {
|
||||
minify: false,
|
||||
output: 'static',
|
||||
integrations: [react(), tailwind({ applyBaseStyles: false })],
|
||||
vite: {
|
||||
server:
|
||||
process.env.MODE === 'development'
|
||||
? {
|
||||
https: {
|
||||
cert: fs.readFileSync('./.local-ssl/localhost.pem'),
|
||||
key: fs.readFileSync('./.local-ssl/localhost-key.pem'),
|
||||
},
|
||||
}
|
||||
: {},
|
||||
build: {
|
||||
minify: false,
|
||||
},
|
||||
plugins: [
|
||||
optimizer({
|
||||
'node-fetch':
|
||||
'const e = undefined; export default e;export {e as Response, e as FormData, e as Blob};',
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
optimizer({
|
||||
"node-fetch":
|
||||
"const e = undefined; export default e;export {e as Response, e as FormData, e as Blob};",
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
})
|
||||
|
|
|
@ -2,8 +2,14 @@ import type { APIRoute } from "astro";
|
|||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
|
||||
export const GET: APIRoute = ({params, request}) => {
|
||||
const filePath = path.resolve(process.cwd(), "dist/sw.js");
|
||||
const fileContents = fs.readFileSync(filePath);
|
||||
return new Response(fileContents, { status: 200, headers: { 'Content-Type': 'application/javascript' } });
|
||||
}
|
||||
export const GET: APIRoute = ({ params, request }) => {
|
||||
if (process.env.MODE !== "development") {
|
||||
return new Response();
|
||||
}
|
||||
const filePath = path.resolve(process.cwd(), "dist/sw.js");
|
||||
const fileContents = fs.readFileSync(filePath);
|
||||
return new Response(fileContents, {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/javascript" },
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue