-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
46 lines (41 loc) · 1.54 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
const Dotenv = require('dotenv-webpack');
const withTs = require('@zeit/next-typescript');
const path = require('path');
const assetPrefix = require('./app/helpers/asset-prefix.ts');
module.exports = withTs({
assetPrefix,
webpack: (config, { dev }) => {
config.devtool = 'cheap-module-source-map';
config.plugins = config.plugins || [];
// Polyfill for IE11
// https://github.com/zeit/next.js/issues/2468
// const oldEntry = config.entry;
// config.entry = () => {
// return oldEntry().then(entries => {
// entries['main.js'].unshift('core-js');
// return entries;
// });
// };
config.plugins = config.plugins.filter(plugin => {
const name = plugin.constructor.name;
return name !== 'ModuleConcatenationPlugin';
});
/**
* Use HSS_ZIP to compile unminified code ONLY to create Veracode zip.
* Please do not use this variable for dev or prod cases
*/
if (process.env.HSS_ZIP) {
config.plugins = config.plugins.filter(plugin => {
const name = plugin.constructor.name;
return name !== 'UglifyJsPlugin' && name !== 'ModuleConcatenationPlugin';
});
}
config.plugins.push(new Dotenv());
// Also tried TsConfigPathsPlugin here but got javascript heap out of memory error
config.resolve.modules.push(path.resolve('./node_modules'));
config.resolve.modules.push(path.resolve('./app'));
config.resolve.modules.push(path.resolve('./app/redux'));
config.resolve.modules.push(path.resolve('./static'));
return config;
},
});