Browse Source

chore(deps): update to next config to address build errors

pull/3461/head
Gabe Kangas 3 years ago
parent
commit
27c48c4068
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
  1. 8
      web/.knip.json
  2. 124
      web/next.config.js

8
web/.knip.json

@ -11,14 +11,13 @@
"public/**", "public/**",
"tests/**", "tests/**",
"i18n/index.js", "i18n/index.js",
"i18next-parser.config.mjs", "i18next-parser.config.mjs"
], ],
"ignoreDependencies": [ "ignoreDependencies": [
"@fontsource/inter", "@fontsource/inter",
"@fontsource/poppins", "@fontsource/poppins",
"@next/bundle-analyzer", "@next/bundle-analyzer",
"autoprefixer", "autoprefixer",
"webpack-deadcode-plugin",
"yaml", "yaml",
"postcss-flexbugs-fixes", "postcss-flexbugs-fixes",
"sharp", "sharp",
@ -33,9 +32,7 @@
"@storybook/addon-links", "@storybook/addon-links",
"@storybook/addon-postcss", "@storybook/addon-postcss",
"@storybook/addon-viewport", "@storybook/addon-viewport",
"@storybook/builder-webpack5",
"@storybook/cli", "@storybook/cli",
"@storybook/manager-webpack5",
"@storybook/mdx2-csf", "@storybook/mdx2-csf",
"@storybook/preset-scss", "@storybook/preset-scss",
"@mdx-js/react", "@mdx-js/react",
@ -66,16 +63,13 @@
"less-loader", "less-loader",
"mdx-mermaid", "mdx-mermaid",
"mermaid", "mermaid",
"prettier",
"sass-loader", "sass-loader",
"sb", "sb",
"storybook-addon-designs",
"storybook-addon-fetch-mock", "storybook-addon-fetch-mock",
"storybook-preset-less", "storybook-preset-less",
"style-loader", "style-loader",
"ts-jest", "ts-jest",
"stylelint-config-standard", "stylelint-config-standard",
"stylelint-config-standard-scss",
"postcss", "postcss",
"stylelint", "stylelint",
"@babel/core", "@babel/core",

124
web/next.config.js

@ -2,7 +2,7 @@ const withLess = require('next-with-less');
const withBundleAnalyzer = require('@next/bundle-analyzer')({ const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true', enabled: process.env.ANALYZE === 'true',
}); });
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
const runtimeCaching = require('next-pwa/cache'); const runtimeCaching = require('next-pwa/cache');
const withPWA = require('next-pwa')({ const withPWA = require('next-pwa')({
@ -31,57 +31,73 @@ const withPWA = require('next-pwa')({
disable: process.env.NODE_ENV === 'development', disable: process.env.NODE_ENV === 'development',
}); });
module.exports = withPWA( async function rewrites() {
withBundleAnalyzer( return [
withLess({ {
productionBrowserSourceMaps: process.env.SOURCE_MAPS === 'true', source: '/api/:path*',
trailingSlash: true, destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS.
reactStrictMode: true, },
images: { {
unoptimized: true, source: '/hls/:path*',
}, destination: 'http://localhost:8080/hls/:path*', // Proxy to Backend to work around CORS.
swcMinify: true, },
output: 'export', {
webpack(config) { source: '/img/:path*',
config.module.rules.push({ destination: 'http://localhost:8080/img/:path*', // Proxy to Backend to work around CORS.
test: /\.svg$/i, },
issuer: /\.[jt]sx?$/, {
use: ['@svgr/webpack'], source: '/logo',
}); destination: 'http://localhost:8080/logo', // Proxy to Backend to work around CORS.
},
{
source: '/thumbnail.jpg',
destination: 'http://localhost:8080/thumbnail.jpg', // Proxy to Backend to work around CORS.
},
{
source: '/customjavascript',
destination: 'http://localhost:8080/customjavascript', // Proxy to Backend to work around CORS.
},
];
}
module.exports = async phase => {
/**
* @type {import('next').NextConfig}
*/
let nextConfig = withPWA(
withBundleAnalyzer(
withLess({
productionBrowserSourceMaps: process.env.SOURCE_MAPS === 'true',
trailingSlash: true,
reactStrictMode: true,
images: {
unoptimized: true,
},
swcMinify: true,
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
});
return config; return config;
}, },
async rewrites() { pageExtensions: ['tsx'],
return process.env.NODE_ENV === 'development' }),
? [ ),
{ );
source: '/api/:path*',
destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS. if (phase === PHASE_DEVELOPMENT_SERVER) {
}, nextConfig = {
{ ...nextConfig,
source: '/hls/:path*', rewrites,
destination: 'http://localhost:8080/hls/:path*', // Proxy to Backend to work around CORS. };
}, } else {
{ nextConfig = {
source: '/img/:path*', ...nextConfig,
destination: 'http://localhost:8080/img/:path*', // Proxy to Backend to work around CORS. output: 'export',
}, };
{ }
source: '/logo', return nextConfig;
destination: 'http://localhost:8080/logo', // Proxy to Backend to work around CORS. };
},
{
source: '/thumbnail.jpg',
destination: 'http://localhost:8080/thumbnail.jpg', // Proxy to Backend to work around CORS.
},
{
source: '/customjavascript',
destination: 'http://localhost:8080/customjavascript', // Proxy to Backend to work around CORS.
},
]
: null;
},
pageExtensions: ['tsx'],
}),
),
);

Loading…
Cancel
Save