Skip to content

Prevent importing from @gitlab/ui/dist

What does this MR do and why?

As a way to make our build and code more consistent, we prevent importing @gitlab/ui from different sources (src or dist).

This change enforces the code to always use src/ instead of dist/ to have our imports match the actual aliases used in our build.

Note to reviewers: ☝️ Start by checking changes in the first commit of this MR to the files eslint.config.mjs and babel.config.js.

Babel changes

As @gitlab/ui/src/utils is now built from source, our compilation had an error:

Module parse failed: Unexpected token
ERROR in /builds/gitlab-org/gitlab/node_modules/@gitlab/ui/src/utils.js 2:9
Module parse failed: Unexpected token (2:9)
File was processed with these loaders:
 * ../../../node_modules/thread-loader/dist/cjs.js
 * ../../../node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export { GlBreakpointInstance, breakpoints } from './utils/breakpoints';
> export * as formValidators from './components/base/form/form_fields/validators';
| export * as formMappers from './components/base/form/form_fields/mappers';

I've updated the babel.config.js to fix this gap by adding @babel/plugin-transform-export-namespace-from.

References

How to set up and validate locally

A green pipeline should be enough.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #554202 (closed)

Edited by Miguel Rincon

Merge request reports

Loading