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

Migrate FTA-FMEA-UI to Vite #151

Closed
5 tasks done
LaChope opened this issue Jan 23, 2024 · 4 comments · Fixed by #153
Closed
5 tasks done

Migrate FTA-FMEA-UI to Vite #151

LaChope opened this issue Jan 23, 2024 · 4 comments · Fixed by #153
Assignees

Comments

@LaChope
Copy link
Collaborator

LaChope commented Jan 23, 2024

A/C:

There is some known "issue": when building with sourcemap, a lot of warnings are displayed (e.g. node_modules/@mui/material/Paper/Paper.js (1:0) Error when using sourcemap for reporting an error: Can't resolve original location of error.), but according to this thread, this is not really a problem and should be ignored.

@LaChope LaChope self-assigned this Jan 23, 2024
LaChope added a commit that referenced this issue Jan 24, 2024
LaChope added a commit that referenced this issue Jan 24, 2024
LaChope added a commit that referenced this issue Jan 24, 2024
LaChope added a commit that referenced this issue Jan 24, 2024
LaChope added a commit that referenced this issue Jan 24, 2024
LaChope added a commit that referenced this issue Jan 24, 2024
LaChope added a commit that referenced this issue Jan 25, 2024
LaChope added a commit that referenced this issue Jan 25, 2024
LaChope added a commit that referenced this issue Jan 25, 2024
@LaChope
Copy link
Collaborator Author

LaChope commented Jan 25, 2024

@blcham It is now fully working, also with docker. I just have a question: do we want to have sourcemap in production? I assume it is not necessary as it is not deployed on Netlify or Storybook (for now, sourcemap is active)

@blcham
Copy link
Contributor

blcham commented Jan 26, 2024

@blcham It is now fully working, also with docker. I just have a question: do we want to have sourcemap in production? I assume it is not necessary as it is not deployed on Netlify or Storybook (for now, sourcemap is active)

Fow now i would leave it included there.

@blcham
Copy link
Contributor

blcham commented Jan 26, 2024

In the current version, we had to explicitly enable code emitted by the Babel ecosystem.


Here is motivation:

  • in "svg-pan-zoom" there is most likely a function exported as "named function"
  • import import * as svgPanZoom from "svg-pan-zoom"; (see PR) works with Vite but only in "npm dev" but not in "npm preview", or behind nginx in dockerization
    • other imports of type import * as .. seems to work well
    • it throws the error svgPanZoom is not a function

To fix it we had 2 options to configure tsconfig.json:
- "allowSyntheticDefaultImports": true
- does not change anything, only allowing for typescript to import CommonJs with the same syntax as you would import ES modules
- "esModuleInterop": true
- this is the recommended way. It does the same, just on top of that it makes sure that CommonJs module


Although maybe not important, but it remains unclear import * as svgPanZoom from "svg-pan-zoom"; did not work correctly at first place.

@LaChope LaChope closed this as completed in 1ff7bc5 Feb 8, 2024
@LaChope
Copy link
Collaborator Author

LaChope commented Feb 8, 2024

@blcham FYI I created ticket out of #151 (comment) here: #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants