-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnext.config.js
More file actions
69 lines (65 loc) · 1.91 KB
/
next.config.js
File metadata and controls
69 lines (65 loc) · 1.91 KB
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
const withPlugins = require("next-compose-plugins");
const SCSS = require("@zeit/next-sass");
const MdxEnhanced = require("next-mdx-enhanced");
const fs = require("fs");
const path = require("path");
const withPWA = require("next-pwa");
const mdxOptions = require("./lib/mdxOptions");
module.exports = {
future: { webpack5: true },
...withPlugins(
[
[SCSS],
[process.env.NODE_ENV === "development" ? MdxEnhanced(mdxOptions) : []],
[
withPWA,
{
pwa: { dest: "public", disable: process.env.NODE_ENV === "development", register: true, sw: "service-worker.js" },
},
],
],
{
webpack(config, { isServer }) {
config.module.rules.push(
{
test: /\.(png|eot|otf|ttf|woff|woff2)$/,
use: {
loader: "url-loader",
},
},
{
loader: "sass-loader",
test: /.scss$/,
options: {
sassOptions: {
outputStyle: "expanded",
sourceMap: true,
},
},
},
fs.readdirSync(path.join(process.cwd(), "styles")).filter(file => file.match(/^_.*\.scss$/)).length > 0
? {
enforce: "pre",
test: /.scss$/,
loader: "sass-resources-loader",
options: {
resources: fs
.readdirSync(path.join(process.cwd(), "styles"))
.filter(file => file.match(/^_.*\.scss$/))
.map(file => `./styles/${file}`),
},
}
: {}
);
if (isServer) {
require("./lib/createSitemap");
}
config.resolve.extensions = [".ts", ".js", ".jsx", ".tsx", ".svg", ".scss"];
return config;
},
}
),
};
module.exports.env = {
BUTTONDOWN_API_KEY: process.env.BUTTONDOWN_API_KEY,
};