-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
95 lines (90 loc) · 2.09 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const { DefinePlugin } = require("webpack");
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
const { LOCALHOST, NODE_ENV, PORT } = process.env;
const withTM = require("next-transpile-modules");
const withPlugins = require("next-compose-plugins");
module.exports = {
async headers() {
return [
{
source: "/api/auth/:slug",
headers: [
{
key: "Cache-Control",
value: "no-store, max-age=0",
},
],
},
];
},
};
const plugins = (isServer) => {
const plugins = [];
if (!isServer) {
plugins.push(
/* OPTIONAL -- append ENVS to client-side process */
new DefinePlugin({
"process.env": {
LOCALHOST: JSON.stringify(LOCALHOST),
NODE_ENV: JSON.stringify(NODE_ENV),
},
})
);
} else {
plugins.push(
/* add console compilation messages */
NODE_ENV === "development" &&
new FriendlyErrorsWebpackPlugin({
compilationSuccessInfo: {
messages: [
`Local development build: \x1b[1m${LOCALHOST}\x1b[0m`,
].filter(Boolean),
notes: [
"Note that the development build is not optimized.",
"To create a production build, use \x1b[1m\x1b[32myarn export\x1b[0m.\n",
],
},
clearConsole: false,
})
);
}
return plugins.filter(Boolean);
};
module.exports = {
webpack(config, { isServer }) {
/* adds custom plugins to client and/or server */
config.plugins.push(...plugins(isServer));
/* return new config to next */
return config;
},
};
const path = require("path");
const withSass = require("@zeit/next-sass");
module.exports = withSass({
/* bydefault config option Read For More Optios
here https://github.com/vercel/next-plugins/tree/master/packages/next-sass*/
cssModules: true,
});
module.exports = withPlugins(
[
[
withTM,
{
transpileModules: [
"react-syntax-highlighter",
]
}
],
])
module.exports = {
/* Add Your Scss File Folder Path Here */
sassOptions: {
includePaths: [path.join(__dirname, "styles")],
},
};
// module.exports = {
// images: {
// loader: "imgix",
// path: "/",
// },
// };