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

Remove use of webpack alias #1908

Closed
Pezmc opened this issue Apr 3, 2023 · 4 comments · Fixed by #1909
Closed

Remove use of webpack alias #1908

Pezmc opened this issue Apr 3, 2023 · 4 comments · Fixed by #1909
Assignees
Labels
task A piece of work that isn't necessarily tied to a specific Epic or Story.

Comments

@Pezmc
Copy link
Contributor

Pezmc commented Apr 3, 2023

Description

Using webpacks non ES standard aliases looks slightly nicer but breaks one of the key advantages of ES modules, static analysis.

Our aliases e.g. @:

  • Lock us to webpack making it harder to swap to another tool
  • Prevent lots of tooling from working correctly, including VSCodes "open file" shortcuts.
  • Prevent static analysis, e.g. eslint checking all files exist
  • Doesn't autocomplete
  • Make it harder to differentiate the scope of the component
  • Encourage shared components not being placed in a shared components folder

Example: elastic/kibana#6430

Epic/Story

No response

@Pezmc Pezmc added the task A piece of work that isn't necessarily tied to a specific Epic or Story. label Apr 3, 2023
@Pezmc Pezmc self-assigned this Apr 3, 2023
@Steve-Mcl
Copy link
Contributor

Steve-Mcl commented Apr 3, 2023

Fab - cannot wait for this to be merged.

One question @Pezmc can we (should we) also add the file extension to the imports? i.e. be more explicit.

It may not be an issue now you are moving away from aliases but for my own dev env, I had a temporary jsconfig,json file to help VSCode resolve the aliases (for intellisense, navigation, type hints etc) but the vue files still needed the .vue extension for navigation to work. Basically, around half of our page imports have them and half do not.

Thoughts please?

@Steve-Mcl Steve-Mcl linked a pull request Apr 3, 2023 that will close this issue
9 tasks
@Pezmc
Copy link
Contributor Author

Pezmc commented Apr 3, 2023

Yes, I'd lean towards explicitly adding .vue, the handling of .vue is also a custom webpack handling so am 👍 to adding it to decouple us from webpack and improve static code analysis.

Can I handle that as a follow up?

@Steve-Mcl
Copy link
Contributor

Can I handle that as a follow up?

Sure thing.

@Pezmc
Copy link
Contributor Author

Pezmc commented Apr 4, 2023

Done in #1910 @Steve-Mcl

@MarianRaphael MarianRaphael moved this from ✅ Ready to Closed / Done in ☁️ Product Planning Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task A piece of work that isn't necessarily tied to a specific Epic or Story.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants