-
Notifications
You must be signed in to change notification settings - Fork 98
/
next.config.js
62 lines (56 loc) · 1.61 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
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const { patchWebpackConfig } = require("next-global-css");
const rewrites = async () => {
const ret = [
{
source: '/sandpack',
destination: '/sandpack/index.html',
},
{
source: "/plausible/js/script.js",
destination: "https://plausible.io/js/script.js",
},
{
source: "/plausible/api/event",
destination: "https://plausible.io/api/event",
},
];
return {
beforeFiles: ret,
};
};
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
eslint: {
ignoreDuringBuilds: true,
},
rewrites,
typescript: {
ignoreBuildErrors: true,
},
publicRuntimeConfig: {
apiPath: '/api/',
backendOrigin: process.env.NEXT_PUBLIC_BACKEND_URL,
},
webpack: (config, options) => {
// allow global CSS to be imported from within node_modules
// see also:
// - https://nextjs.org/docs/messages/css-npm
// - https://github.com/vercel/next.js/discussions/27953
patchWebpackConfig(config, options);
config.module.rules.push({ test: /\.ttf$/, type: "asset/resource" });
// when `isServer` is `true`, building (`next build`) fails with the following error:
// "Conflict: Multiple assets emit different content to the same filename ../main.js.nft.json"
if (!options.isServer) {
config.plugins.push(
new MonacoWebpackPlugin({
languages: ["javascript", "typescript", "html"],
filename: 'static/[name].worker.js',
})
);
}
return config;
},
}
module.exports = nextConfig