-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
37 lines (35 loc) · 1.05 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
const { PHASE_PRODUCTION_BUILD } = require('next/dist/shared/lib/constants');
module.exports = (phase) => {
const isProdBuild = phase === PHASE_PRODUCTION_BUILD;
/** @type {import('next').NextConfig} */
const config = {
compress: true, // default
swcMinify: true, // default || Terser
cleanDistDir: true, // default
reactStrictMode: true,
transpilePackages: ['lodash-es'],
// [babel-plugin-transform-imports]:
modularizeImports: {
lodash: {
transform: 'lodash/{{member}}',
preventFullImport: true,
},
},
experimental: {
forceSwcTransforms: true, // SWC || Babel
// optimizeCss: true // Use "Critters" package
},
sassOptions: {
prependData: '@import "mixins";',
},
compiler: {
...(isProdBuild && {
// [babel-plugin-react-remove-properties]:
reactRemoveProperties: { properties: ['^data-testid$'] },
// [babel-plugin-transform-remove-console]:
removeConsole: { exclude: ['info', 'error'] },
}),
},
};
return config;
};