forked from jamdotdev/jam-dev-utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
63 lines (58 loc) · 1.57 KB
/
next.config.mjs
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
/** @type {import('next').NextConfig} */
import CopyPlugin from "copy-webpack-plugin";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const nextConfig = {
reactStrictMode: true,
async redirects() {
return [
{
source: "/",
destination: "/utilities",
permanent: true,
},
];
},
webpack: (config, { isServer }) => {
if (!isServer) {
// Enable top-level await and async WebAssembly
config.experiments = {
...config.experiments,
topLevelAwait: true,
asyncWebAssembly: true,
};
// Ignore 'fs' module
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
// Copy WebAssembly (WASM) files to the public directory.
// This approach is necessary for proper functionality.
// Reference: https://www.npmjs.com/package/curlconverter
config.plugins.push(
new CopyPlugin({
patterns: [
{
from: path.join(
__dirname,
"node_modules/web-tree-sitter/tree-sitter.wasm"
),
to: path.join(__dirname, "public"),
},
{
from: path.join(
__dirname,
"node_modules/curlconverter/dist/tree-sitter-bash.wasm"
),
to: path.join(__dirname, "public"),
},
],
})
);
}
return config;
},
};
export default nextConfig;