-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
43 lines (41 loc) · 1.16 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
const withLess = require('@zeit/next-less')
/* Without CSS Modules, with PostCSS */
// module.exports = withLess()
/* With CSS Modules */
// module.exports = withLess({ cssModules: true })
/* With additional configuration on top of CSS Modules */
module.exports = withLess({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: process.env.NODE_ENV === 'production'? "[hash:base64:5]" : "[name]__[local]___[hash:base64:5]",
},
webpack: function (config) {
config.resolve.alias = {
...config.resolve.alias,
'@': `${__dirname}`,
}
config.module.rules = [
...config.module.rules,
{
test: /\.(jpe?g|png|gif|svg)$/i,
use: [
{
loader: 'file-loader',
options: {
name(file) {
if (process.env.NODE_ENV === 'production') {
return '[contenthash].[ext]';
}
return '[path][name].[ext]';
},
publicPath: "/_next/static/images",
outputPath: "static/images/",
},
}
]
}
]
return config;
}
});