-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.js
More file actions
31 lines (25 loc) · 914 Bytes
/
next.config.js
File metadata and controls
31 lines (25 loc) · 914 Bytes
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
const { Plugin } = require('@csssr/csssr.images/dist/webpack/plugin')
const withPlugins = require('next-compose-plugins')
const { getImagesLoaderRules } = require('./utils/getImagesLoaderRules')
const withImages = (nextConfig = {}) => ({
...nextConfig,
env: {
...nextConfig.env,
IS_PRODUCTION: process.env.IS_PRODUCTION === 'TRUE',
},
webpack(config, { dev, isServer }) {
config.node = {
fs: 'empty',
}
config.module.rules.push(...getImagesLoaderRules(dev, false, isServer))
if (!dev) {
// TODO подключить позже, нужен для обхода всех картинок проекта перед выкладкой на прод
config.plugins.push(new Plugin())
}
return config
},
})
module.exports = withPlugins([withImages], {
env: { BLOG_HOST: process.env.BLOG_HOST, COM_HOST: process.env.COM_HOST },
trailingSlash: true,
})