-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
49 lines (43 loc) · 1.21 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/** @type {import('next').NextConfig} */
const withPWA = require("next-pwa");
const Dotenv = require("dotenv-webpack");
const runtimeCaching = require("next-pwa/cache");
const util = require("util");
const cacheTime = 365 * 24 * 60 * 60; // 365 days
runtimeCaching.map((item) => {
item.options.expiration.maxAgeSeconds = cacheTime;
if (item.options.cacheName === "others") {
item.options.expiration.maxEntries = 200;
}
if (item.options.cacheName === "static-image-assets") {
item.options.expiration.maxEntries = 100;
}
});
// console.log('😜 RUNTIME CACHE =>', JSON.stringify(runtimeCaching, null, 4))
// console.log('😜 RUNTIME CACHE =>', runtimeCaching)
module.exports = withPWA({
pwa: {
dest: "public",
importScripts: ["/worker.js"],
runtimeCaching,
},
webpack: (config) => {
// Add the new plugin to the existing webpack plugins
config.plugins.push(new Dotenv({ silent: true }));
return config;
},
env: {
NASA_API_KEY: process.env.NASA_API_KEY,
},
images: {
unoptimized: true,
deviceSizes: [320, 640, 768, 1024, 1600],
domains: ["apod.nasa.gov"],
},
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
});