-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
47 lines (40 loc) · 1.21 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
const bsconfig = require('./bsconfig.json');
const fs = require('fs');
const transpileModules = ['bs-platform'].concat(bsconfig['bs-dependencies']);
const withTranspiler = require('next-transpile-modules')(transpileModules);
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const config = {
transpileModules,
target: 'serverless',
pageExtensions: ['jsx', 'js'],
env: {
ENV: process.env.NODE_ENV,
},
webpack: (config, options) => {
const { isServer } = options;
if (!isServer) {
config.resolve.fallback = {
fs: false,
path: false,
};
}
/* Precisamos dessa regra adicional apra que os arquivos com
extensào .mjs sejam encontrados junto ao diretório src/ */
/* We need this additional rule to make sure that mjs files are
correctly detected within our src/ folder */
config.module.rules.push({
test: /\.m?js$/,
use: options.defaultLoaders.babel,
exclude: /node_modules/,
type: 'javascript/auto',
resolve: {
fullySpecified: false,
},
});
return config;
},
webpack5: true,
};
module.exports = withTranspiler(withBundleAnalyzer(config));