-
Notifications
You must be signed in to change notification settings - Fork 23
/
next.config.js
55 lines (54 loc) · 1.6 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
48
49
50
51
52
53
54
55
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
const withSass = require("@zeit/next-sass");
const withSourceMaps = require("@zeit/next-source-maps")({
devtool: "hidden-source-map",
});
const isAWSDeploy = process.env.DEPLOY_TARGET === "aws";
module.exports = withSass(
withSourceMaps({
/* config options here */
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
// Important: return the modified config
if (isAWSDeploy) {
config.plugins.push(
new webpack.DefinePlugin({
"process.env.SENTRY_RELEASE": JSON.stringify(buildId),
})
);
config.plugins.push(
new SentryWebpackPlugin({
include: ".next",
ignore: ["node_modules"],
urlPrefix: "~/_next",
release: buildId,
})
);
}
config.module.rules.push({
test: /\.css$/,
loader: "style-loader!css-loader",
});
config.module.rules.push({
test: /\.md$/,
use: [
{
loader: "html-loader",
},
{
loader: "markdown-loader",
options: {},
},
],
});
return config;
},
webpackDevMiddleware: (config) => {
// Perform customizations to webpack dev middleware config
// Important: return the modified config
return config;
},
assetPrefix: isAWSDeploy ? "https://d1s7vqgr1bmmob.cloudfront.net" : "",
})
);