forked from gravity-ui/landing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
79 lines (71 loc) · 2.42 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
72
73
74
75
76
77
78
79
const {join} = require('path');
const withPlugins = require('next-compose-plugins');
const {patchWebpackConfig} = require('next-global-css');
const withTM = require('next-transpile-modules')([
'@gravity-ui/page-constructor',
'@gravity-ui/components',
'@gravity-ui/date-components',
'@gravity-ui/chartkit',
'@gravity-ui/yagr',
]);
const plugins = [
[
withTM,
{
webpack: (config, options) => {
patchWebpackConfig(config, options);
config.module.rules.push({
issuer: /\.(tsx|ts|js|cjs|mjs|jsx)$/,
test: /\.svg$/,
exclude: join(__dirname, 'src/assets/icons'),
use: [
{
loader: 'file-loader',
options: {
context: '',
outputPath: 'static/media',
publicPath: '_next/static/media',
name: '[name].[hash:8].[ext]',
},
},
],
});
config.module.rules.push({
issuer: /\.(tsx|ts|js|cjs|mjs|jsx)$/,
test: /icons\/.*\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [
{
name: 'removeViewBox',
active: false,
},
],
},
},
},
],
});
config.module.rules.push({
test: /\.(md|mdx)$/,
use: 'raw-loader',
});
if (!options.isServer) {
config.resolve.fallback.fs = false;
}
return config;
},
},
],
];
/** @type {import('next').NextConfig} */
module.exports = withPlugins(plugins, {
reactStrictMode: true,
output: 'export',
experimental: {
esmExternals: 'loose',
},
});