From 8af9c6576d9d2a9d2d4ff9e863a310000b881848 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 18 Mar 2022 17:24:16 +0100 Subject: build(web/ui): Migrate to next-global-css This change updates the web interface to use next-global-css instead of next-transpile-modules. This approach is more efficient since it does not require transpilation of the dependencies. --- opendc-web/opendc-web-ui/next.config.js | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'opendc-web/opendc-web-ui/next.config.js') diff --git a/opendc-web/opendc-web-ui/next.config.js b/opendc-web/opendc-web-ui/next.config.js index 1dfe4156..ceb0900e 100644 --- a/opendc-web/opendc-web-ui/next.config.js +++ b/opendc-web/opendc-web-ui/next.config.js @@ -22,39 +22,21 @@ // PatternFly 4 uses global CSS imports in its distribution files. Therefore, // we need to transpile the modules before we can use them. -const withTM = require('next-transpile-modules')([ - '@patternfly/react-core', - '@patternfly/react-styles', - '@patternfly/react-table', - '@patternfly/react-tokens', -]) +const { withGlobalCss } = require('next-global-css') +const withConfig = withGlobalCss() -module.exports = withTM({ +module.exports = withConfig({ reactStrictMode: true, experimental: { - eslint: true, + eslint: true }, async redirects() { return [ { source: '/', destination: '/projects', - permanent: true, - }, - ] - }, - webpack: (config, options) => { - if (options.dev) { - config.optimization.splitChunks = { - cacheGroups: { - vendor: { - test: /[\\/]node_modules[\\/]/, - name: 'transpiled-modules', - chunks: 'all', - }, - }, + permanent: true } - } - return config + ] } }) -- cgit v1.2.3 From 6d67cabc6fd3d59982a9501fad08b8e06a2e2d5b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 17 Mar 2022 17:29:12 +0100 Subject: build(web/ui): Add Gradle integration with Next.js project This change adds support for building the OpenDC web interface project that uses Next.js using Gradle. This enables a single build pipeline using Gradle. --- opendc-web/opendc-web-ui/next.config.js | 1 + 1 file changed, 1 insertion(+) (limited to 'opendc-web/opendc-web-ui/next.config.js') diff --git a/opendc-web/opendc-web-ui/next.config.js b/opendc-web/opendc-web-ui/next.config.js index ceb0900e..59341b1f 100644 --- a/opendc-web/opendc-web-ui/next.config.js +++ b/opendc-web/opendc-web-ui/next.config.js @@ -30,6 +30,7 @@ module.exports = withConfig({ experimental: { eslint: true }, + distDir: 'build/next', async redirects() { return [ { -- cgit v1.2.3 From 6cf097b60366ecb2116f742be4374fcec841a950 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 18 Mar 2022 13:34:09 +0100 Subject: build(web/ui): Support building WebJar for OpenDC web UI This change updates the build process to build a static WebJar out of the OpenDC web UI module. This allows us to embed the UI inside the development distribution of OpenDC for other users to readily deploy it. --- opendc-web/opendc-web-ui/next.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'opendc-web/opendc-web-ui/next.config.js') diff --git a/opendc-web/opendc-web-ui/next.config.js b/opendc-web/opendc-web-ui/next.config.js index 59341b1f..d8029108 100644 --- a/opendc-web/opendc-web-ui/next.config.js +++ b/opendc-web/opendc-web-ui/next.config.js @@ -23,14 +23,16 @@ // PatternFly 4 uses global CSS imports in its distribution files. Therefore, // we need to transpile the modules before we can use them. const { withGlobalCss } = require('next-global-css') +const { PHASE_DEVELOPMENT_SERVER } = require("next/constants"); const withConfig = withGlobalCss() -module.exports = withConfig({ +module.exports = (phase) => withConfig({ + basePath: process.env.NEXT_BASE_PATH && '/' + process.env.NEXT_BASE_PATH, reactStrictMode: true, experimental: { eslint: true }, - distDir: 'build/next', + distDir: phase === PHASE_DEVELOPMENT_SERVER ? 'build/next-dev' : 'build/next', async redirects() { return [ { -- cgit v1.2.3