-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
44 lines (39 loc) · 1.31 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
// https://v4.webpack.js.org/concepts/plugins/
// From https://github.com/taehwanno/warnings-to-errors-webpack-plugin/blob/master/index.js
class WarningsToErrorsPlugin {
apply(compiler) {
compiler.hooks.shouldEmit.tap("WarningsToErrorsPlugin", compilation => {
if (compilation.warnings.length > 0) {
compilation.errors = compilation.errors.concat(compilation.warnings);
compilation.warnings = [];
}
for (const child of compilation.children) {
if (child.warnings.length > 0) {
child.errors = child.errors.concat(child.warnings);
child.warnings = [];
}
}
});
}
}
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
// TODO https://github.com/zeit/next.js/blob/canary/examples/with-next-offline/next.config.js
module.exports = (phase, { defaultConfig }) => {
return {
output: "export",
trailingSlash: true,
typescript: {
ignoreBuildErrors: true || phase === PHASE_DEVELOPMENT_SERVER,
},
eslint: {
ignoreDuringBuilds: true,
},
webpack(config, options) {
config.resolve = config.resolve || {};
config.resolve.alias = config.resolve.alias || {};
// config.resolve.alias.Data = dataFolder;
config.plugins.push(new WarningsToErrorsPlugin());
return config;
},
};
};