title: plugin:vite:import-analysis - Failed to parse source for import analysis because the content contains invalid JS syntax. - Vue 3
body: <p>I've updated my project from Vite 2.x to Vite 3.0.2 and suddenly i got this error:</p>
  <blockquote>
  <p>[plugin:vite:import-analysis] Failed to parse source for import
  analysis because the content contains invalid JS syntax. If you are
  using JSX, make sure to name the file with the .jsx or .tsx extension.</p>
  <p>/Volumes/Disk/Web/wce-system/src/i18n.js:51:20</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/Hkci3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hkci3.png" alt="Failed to parse source for import analysis because the content contains invalid JS syntax." /></a></p>
  <p>There's nothing wrong in i18n.js file as it was working fine with Vite 2.x but im putting codes in here just in case you need:</p>
  <pre><code>import { nextTick } from &quot;vue&quot;
  import { createI18n } from &quot;vue-i18n&quot;
  import axios from &quot;axios&quot;
  import tr from &quot;@/locales/tr.json&quot;
  import en from &quot;@/locales/en.json&quot;
  
  export const SUPPORT_LOCALES = [&quot;tr&quot;, &quot;en&quot;]
  
  export function setupI18n(options = { locale: &quot;tr&quot; }) {
  const i18n = createI18n(options)
  setI18nLanguage(i18n, options.locale)
    return i18n
  }
  
  export function setI18nLanguage(i18n, locale, url) {
    if (i18n.mode === &quot;legacy&quot;) {
    i18n.global.locale = locale
  } else {
    i18n.global.locale.value = locale
  }       
  axios.defaults.headers.common[&quot;Accept-Language&quot;] = locale
  document.querySelector(&quot;html&quot;).setAttribute(&quot;lang&quot;, locale)
  }
  
  export async function loadLocaleMessages(i18n, locale) {
   const messages = await import(
  /* webpackChunkName: &quot;locale-[request]&quot; */ `./locales/${locale}.json`
  )
  
  i18n.global.setLocaleMessage(locale, messages.default)
   return nextTick()
  }
  
  const i18n = createI18n({
    legacy: false,
    locale: &quot;tr&quot;,
    fallbackLocale: &quot;tr&quot;,
    globalInjection: true,
    messages: {
      tr,
      en,
    },
  })
  
  export default i18n
  </code></pre>