forked from friendsofagape/autographa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
55 lines (53 loc) · 1.26 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
const nodeExternals = require('webpack-node-externals');
const withTM = require('next-transpile-modules')(['usfm-editor']);
const path = require('path');
module.exports = withTM({
webpack: (config, { isServer, webpack }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
// eslint-disable-next-line no-param-reassign
config.resolve.fallback.fs = false;
}
config.plugins.push(
new webpack.IgnorePlugin(/canvas/),
);
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader',
});
config.module.rules.push({
include: path.resolve(__dirname, 'node_modules/canvas'),
use: 'null-loader',
});
config.module.rules.push({
test: /\.svg$/,
use: [{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [{
removeViewBox: false,
},
{ removeDimensions: true },
{
removeAttrs: {
attrs: ['fill'],
},
}],
},
},
},
],
});
return config;
},
images: {
disableStaticImages: true,
},
webpack5: true,
externals: [nodeExternals()],
target: 'serverless',
fallback: {
fs: false,
},
});