This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
next.config.js
73 lines (59 loc) · 1.66 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
// @ts-ignore
require('dotenv').config();
const path = require('path');
const sass = require('@zeit/next-sass');
const plugins = require('next-compose-plugins');
const images = require('next-images');
const videos = require('next-videos');
const fonts = require('next-fonts');
const reactSvg = require('next-react-svg');
const nextConfig = {
serverRuntimeConfig: {
/*
* Will only be available on the server side
* Use `import { config } from 'utils/config';`
*/
},
publicRuntimeConfig: {
/*
* Will be available on both server and client
* Use `import { config } from 'utils/config';`
*/
},
webpack(config) {
const classNamesLoader = require.resolve('next-classnames-loader');
const styleRules = config.module.rules.filter((rule) => {
if (!rule.test) {
return;
}
return rule.test.test('file.scss') || rule.test.test('file.sass');
});
styleRules.forEach((styleRule) => {
if (styleRule.use && styleRule.use.indexOf(classNamesLoader) === -1) {
styleRule.use.splice(0, 0, classNamesLoader);
}
});
config.resolve = config.resolve || {};
config.resolve.modules = [path.join(__dirname, 'src'), path.join(__dirname, 'node_modules')];
return config;
},
};
module.exports = plugins(
[
[
sass,
{
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]',
},
},
],
[images, { exclude: path.resolve(__dirname, 'src/assets/svg') }],
[reactSvg, { include: path.resolve(__dirname, 'src/assets/svg') }],
fonts,
videos,
],
nextConfig,
);