-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnext.config.js
71 lines (64 loc) · 2.2 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/** @type {import('next').NextConfig} */
const withTM = require('next-transpile-modules')(['gsap']);
const CopyPlugin = require("copy-webpack-plugin");
const nextConfig = {
...withTM,
output: 'export',
images: {
loader: 'custom',
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
transpilePackages: ['next-image-export-optimizer'],
env: {
nextImageExportOptimizer_imageFolderPath: 'public/images',
nextImageExportOptimizer_exportFolderPath: 'out',
nextImageExportOptimizer_quality: '75',
nextImageExportOptimizer_storePicturesInWEBP: 'true',
nextImageExportOptimizer_exportFolderName: 'nextImageExportOptimizer',
// If you do not want to use blurry placeholder images, then you can set
// nextImageExportOptimizer_generateAndUseBlurImages to false and pass
// `placeholder="empty"` to all <ExportedImage> components.
nextImageExportOptimizer_generateAndUseBlurImages: 'true',
},
reactStrictMode: true,
trailingSlash: true,
images: {
unoptimized: true,
disableStaticImages: false,
domains: ['picsum.photos', 'placehold.it', 'datocms-assets.com'],
},
compiler: {
// see https://styled-components.com/docs/tooling#babel-plugin for more info on the options.
styledComponents: true,
},
webpack: (config, { dev, isServer }) => {
config.experiments = {
asyncWebAssembly: true,
topLevelAwait: true,
layers: true,
};
// workaround for wasm from https://github.com/vercel/next.js/issues/29362#issuecomment-1973553746
if (!dev && isServer) {
webassemblyModuleFilename = "./../server/chunks/[modulehash].wasm";
const patterns = [];
const destinations = [
"../static/wasm/[name][ext]", // -> .next/static/wasm
"./static/wasm/[name][ext]", // -> .next/server/static/wasm
"." // -> .next/server/chunks (for some reason this is necessary)
];
for (const dest of destinations) {
patterns.push({
context: ".next/server/chunks",
from: ".",
to: dest,
filter: (resourcePath) => resourcePath.endsWith(".wasm"),
noErrorOnMissing: true
});
}
config.plugins.push(new CopyPlugin({ patterns }));
}
return config;
}
};
module.exports = nextConfig;