Skip to content

Flynt Next: Backward compatiblity #484

Answered by timohubois
aaronmeder asked this question in Q&A
Discussion options

You must be logged in to vote

@aaronmeder we talked today in our team about this topic. To add legacy support for javascript you can try the following:

  1. Install @vitejs/plugin-legacy and add it to the vite.config.js
import legacy from '@vitejs/plugin-legacy'

  plugins: [
    flynt({ dest, host }),
    FullReload(watchFiles),
    legacy()
  ],
  1. After that replace all occurrences where a adventlistener is used in combination with matchMedia, and provide a fallback solution.

For example (script.js from Navigation Main):

  if (isDesktopMediaQuery?.addEventListener) {
    isDesktopMediaQuery.addEventListener('change', onBreakpointChange)
  } else {
    isDesktopMediaQuery.addListener(onBreakpointChange)
  }

or (FlyntCom…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@aaronmeder
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by timohubois
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants