Skip to content

Conversation

@arnaugiralt
Copy link
Member

Refactored defineExtensionConfig to be a function (see Vite - Conditional configuration), so it can be aware of Vite's mode (development, production) in order to set up source maps and minification properly.

This needs to be considered as a breaking change, so the major version of the package will need to be updated. This won't require any change in most cases, since the helper is mostly used directly as the argument to Vite's defineConfigmethod, but if someone is using that differently, it will require some modifications.

The following setup (used on the Connect BI Reporter extension) will work without any changes:

// vite.config.js
import { defineExtensionConfig } from '@cloudblueconnect/connect-ui-toolkit/tools/build/vite';
import { defineConfig } from 'vite';

export default defineConfig(defineExtensionConfig({ ... }));

But a setup like the following won't:

// vite.config.js
import { defineExtensionConfig } from '@cloudblueconnect/connect-ui-toolkit/tools/build/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  {
    a: { different: { setup: true } } },
  },
  ...defineExtensionConfig({ ... }),
});

It will need to be updated to call defineExtensionConfigwith Vite's mode:

// vite.config.js
import { defineExtensionConfig } from '@cloudblueconnect/connect-ui-toolkit/tools/build/vite';
import { defineConfig } from 'vite';

export default defineConfig((configEnv) => ({
  {
    a: { different: { setup: true } } },
  },
  ...defineExtensionConfig({ ... })(configEnv),
}));

- Refactor defineExtensionConfig to a function, so it can be aware of Vite's mode (development, production) in order to set up sourcemaps and minification properly.
@arnaugiralt arnaugiralt force-pushed the feat/make-vite-config-aware-of-mode branch from c1a4c26 to a3787f4 Compare March 8, 2024 10:54
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 8, 2024

@arnaugiralt arnaugiralt merged commit 2b0b4c8 into master Mar 8, 2024
@arnaugiralt arnaugiralt deleted the feat/make-vite-config-aware-of-mode branch March 8, 2024 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants