@atlassian/atlaskit-theme-excluded-webpack-plugin
v0.1.0
Published
Webpack/Rspack plugin that stubs out @atlaskit/tokens theme imports to prevent @atlaskit-internal_* theme chunk files from being emitted into the build output.
Maintainers
Readme
@atlassian/atlaskit-theme-excluded-webpack-plugin
Prevents @atlaskit/tokens from emitting @atlaskit-internal_* theme chunk files into the webpack/rspack build output.
Why?
New Atlaskit components (e.g. @atlaskit/modal-dialog, @atlaskit/popup) use @atlaskit/tokens for theming. Internally, @atlaskit/tokens uses dynamic imports that cause webpack to emit separate chunk files for each theme:
@atlaskit-internal_atlassian-dark.bundle.js
@atlaskit-internal_atlassian-light.bundle.js
@atlaskit-internal_atlassian-custom-theme.bundle.js
...In Atlassian Data Center (DC) plugins, themes are loaded globally by the host application and must not be bundled. This plugin stubs out the theme imports so webpack never creates those chunks.
Usage
const { AtlaskitThemeExcludePlugin } = require('@atlassian/atlaskit-theme-excluded-webpack-plugin');
module.exports = {
plugins: [new AtlaskitThemeExcludePlugin()],
};Works with both webpack 5 and rspack.
