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

Allowing webpack module aliases for plugins #760

Open
rios0rios0 opened this issue Sep 2, 2021 · 1 comment
Open

Allowing webpack module aliases for plugins #760

rios0rios0 opened this issue Sep 2, 2021 · 1 comment
Labels
build Build related additions or modifications enhancement New feature or request technical debt If not paid, jeapardizes long-term success and maintainability of the repository.

Comments

@rios0rios0
Copy link

rios0rios0 commented Sep 2, 2021

Hello guys, I'm working a lot with plugins on OpenSearch Dashboards.
And my plugin is big and has a lot of features...
Then, I'm facing some challenges to developing inside the platform. Bellow, follow some challenges, that I solved with some modifications on @osd/optimizer.

Please, could you read carefully and help me to merge if it's possible?

Is your feature request related to a problem? Please describe.

To avoid relative imports like "../../../../" on the "public" folder of a plugin, I made some modifications to receive module-alias with Bundle public interface already provided. It'll possibility to work with an alias on import, at least on the frontend plugin, on React part. We can import things like this: import { Something } from '@my-weird-alias' without placing a relative path to the Something object.

My modifications are based on:

  1. https://www.npmjs.com/package/module-alias#usage-with-webpack
  2. https://webpack.js.org/configuration/resolve/#resolvealias

Describe the solution you'd like

I only would like to avoid terrible relative paths on imports and create my own aliases to import my components and screens. It'll be possibly with the webpack feature.

Describe alternatives you've considered

Webpack is used in all frontend plugins of Dashboards solution. Then, I didn't need to test another solution, because is more fancy and clear to use the built-in tools and packages installed.

Additional context

Looking at my PR (#761) is clear to see the modifications. It's not big. I believe that's simple to understand what I mean.

@rios0rios0 rios0rios0 added the enhancement New feature or request label Sep 2, 2021
@kavilla kavilla changed the title Allowing webapck module aliases for plugins Allowing webpack module aliases for plugins Sep 10, 2021
@kavilla kavilla linked a pull request Sep 11, 2021 that will close this issue
5 tasks
@tmarkley tmarkley added the technical debt If not paid, jeapardizes long-term success and maintainability of the repository. label May 25, 2022
@joshuarrrr
Copy link
Member

While the linked PR was closed for lack of tests and inactivity, we would still accept a PR along these lines. For more discussion on the future of @osd/optimizer, webpack, and bundling in general, see #2875.

@joshuarrrr joshuarrrr added build Build related additions or modifications and removed untriaged labels Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build related additions or modifications enhancement New feature or request technical debt If not paid, jeapardizes long-term success and maintainability of the repository.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants