infi-pc / locatorjs

https://www.locatorjs.com
1.31k stars 60 forks source link

bug: windows os , vite react can't working #135

Open tomatobybike opened 9 months ago

tomatobybike commented 9 months ago

Where the bug happens

your browser

chrome

Describe the bug

yarn run start throw this: vite Error: offset is longer than source length! offset 214 > length 112

but on mac os , everything is ok


windows os ,when i delete this code in vite.config.js

        [
          '@locator/babel-jsx/dist',
          {
            env: 'development'
          }
        ]

the web can work

tomatobybike commented 9 months ago

So, i change the vite config like this:

if (process.platform !== 'win32') {
  babelPlugins.push([
    '@locator/babel-jsx/dist',
    {
      env: 'development'
    }
  ])
}

react({
    babel: {
      plugins: babelPlugins
    }
  })

if the platform is win32 ,remove this plugin