-
Notifications
You must be signed in to change notification settings - Fork 937
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
Support path alias for webpack and babel #9205
base: main
Are you sure you want to change the base?
Support path alias for webpack and babel #9205
Conversation
Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9205 +/- ##
==========================================
+ Coverage 60.93% 61.05% +0.11%
==========================================
Files 3809 3816 +7
Lines 91270 91493 +223
Branches 14414 14459 +45
==========================================
+ Hits 55618 55858 +240
+ Misses 32097 32070 -27
- Partials 3555 3565 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
can we have some existing code updated to new format? so that we can verify it works during build and also take it as example. |
Really nice QoL improvement! |
return new Promise<string | undefined>((resolve) => { | ||
resolver.resolve({}, context, request, {}, (err: Error, resolvedPath: string) => { | ||
if (err) { | ||
resolve(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to silently fail here for all resolver errors? I'm not sure how this is handled upstream, but it may simplify build issue debugging if we reject with error so we don't swallow it.
Description
This PR add path alias support for webpack and babel. Previously, path alias only works for importing typescript types.
opensearch-dashboards/public
path aliascompiler.resolverFactory
to work with webpack path aliasbabel-plugin-module-resolver
to enable path alias support for babel so that we can use path alias in server side code and jest tests.Examples:
For
public
codeFor
server
codeFor jest tests:
Issues Resolved
#9184
Screenshot
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration