Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Support path alias #9184

Open
3 tasks
ruanyl opened this issue Jan 15, 2025 · 0 comments
Open
3 tasks

[enhancement] Support path alias #9184

ruanyl opened this issue Jan 15, 2025 · 0 comments
Assignees
Labels
devex enhancement New feature or request

Comments

@ruanyl
Copy link
Member

ruanyl commented Jan 15, 2025

Problem

Currently, the path aliases opensearch-dashboards/public and opensearch-dashboards/server are defined in the tsconfig and are widely used throughout the codebase. However, these aliases are only functional for TypeScript types. They are not configured for Webpack or Babel, leading to failures during development when running dev server or production builds failed when build for release when these imports contain actual modules rather than just types.

Expectation

The path alias should work for module imports not just only TS types, so I don't have to use relative path when importing modules like import {...} from '../../../../src/core/public'. Instead, I can simply type import {...} from 'opensearch-dashboards/public'.

What to do

  • Add path alias support for webpack to ensure browser side code can be compiled successfully during development and build
  • Add path alias support for babel to ensure server side code can be transpiled successfully
  • Ensure jest unit tests also works with path alias
@ruanyl ruanyl added enhancement New feature or request devex labels Jan 15, 2025
@ruanyl ruanyl self-assigned this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devex enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant