-
Notifications
You must be signed in to change notification settings - Fork 137
/
next.config.js
53 lines (46 loc) · 1.43 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
/** @type {import('next').NextConfig} */
const { withPlausibleProxy } = require('next-plausible')
const nodeModuleReplacement = require('./webpack/nodeModuleReplacement')
module.exports = withPlausibleProxy()({
reactStrictMode: true,
serverRuntimeConfig: {
APP_ROOT: __dirname,
},
webpack: (config, options) => {
const { dir, defaultLoaders } = options
config.resolve.extensions.push('.ts', '.tsx')
config.module.rules.push({
test: /\.+(ts|tsx)$/,
include: [dir],
use: [
defaultLoaders.babel,
{ loader: 'ts-loader', options: { transpileOnly: true } },
],
})
// NOTE: Needed to clear the import assert from rustbn used by ethereumjs
config.module.rules.push({
test: /\.js$/,
include: [dir],
use: [
{
loader: './webpack/importAssertTransformer.js',
},
],
})
// NOTE: Needed to transform various node imports from ethereumjs
config.plugins.push(nodeModuleReplacement.default)
config.resolve.fallback = {
fs: false,
stream: false,
crypto: false,
path: false,
process: require.resolve('process/browser'),
assert: require.resolve('assert/'),
events: require.resolve('events/'),
buffer: require.resolve('buffer/'),
}
// NOTE: Needed because rustbn used by ethereumjs is having a top level await
config.experiments.topLevelAwait = true
return config
},
})