2020-04-18 17:02:31 +00:00
|
|
|
const withPlugins = require("next-compose-plugins");
|
|
|
|
const withCSS = require("@zeit/next-css");
|
|
|
|
const withSass = require("@zeit/next-sass");
|
2020-06-09 13:43:53 +00:00
|
|
|
const withSvgr = require("next-svgr");
|
2020-04-18 17:02:31 +00:00
|
|
|
const withBundleAnalyzer = require("@zeit/next-bundle-analyzer");
|
|
|
|
const nextRuntimeDotenv = require("next-runtime-dotenv");
|
|
|
|
|
|
|
|
const withConfig = nextRuntimeDotenv({ public: ["API_URL", "API_KEY"] });
|
|
|
|
|
2020-06-11 16:31:29 +00:00
|
|
|
// or '' if basePath needs to be left unchanged
|
|
|
|
const basePath = '.';
|
|
|
|
const webpackBasePath = process.env.NODE_ENV = 'production' ? basePath : '';
|
2020-06-09 13:43:53 +00:00
|
|
|
|
2020-06-11 16:31:29 +00:00
|
|
|
const nextConfig = {
|
|
|
|
assetPrefix: webpackBasePath,
|
2020-04-18 17:02:31 +00:00
|
|
|
analyzeServer: ["server", "both"].includes(process.env.BUNDLE_ANALYZE),
|
|
|
|
analyzeBrowser: ["browser", "both"].includes(process.env.BUNDLE_ANALYZE),
|
|
|
|
bundleAnalyzerConfig: {
|
|
|
|
server: {
|
|
|
|
analyzerMode: "static",
|
|
|
|
reportFilename: "../bundles/server.html",
|
|
|
|
},
|
|
|
|
browser: {
|
|
|
|
analyzerMode: "static",
|
|
|
|
reportFilename: "../bundles/client.html",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
publicRuntimeConfig: {
|
|
|
|
PROXY_MODE: process.env.PROXY_MODE,
|
|
|
|
API_URL: process.env.API_URL,
|
|
|
|
API_KEY: process.env.API_KEY,
|
|
|
|
STATIC_PATH: process.env.STATIC_PATH,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = withConfig(
|
2020-06-09 13:43:53 +00:00
|
|
|
withPlugins([[withCSS], [withSass], [withSvgr], [withBundleAnalyzer]], nextConfig)
|
2020-04-18 17:02:31 +00:00
|
|
|
);
|