fengxinming / vite-plugins

Some custom plugins for vitejs.
https://fengxinming.github.io/vite-plugins/
MIT License
70 stars 6 forks source link

got type wrong #2

Closed yoyoys closed 1 year ago

yoyoys commented 3 years ago

vite-plugin-external got wrong type, createExternal must be function but not a type.

fengxinming commented 3 years ago

@yoyoys try vite-plugin-external@1.2.3

imjordanxd commented 3 years ago

@fengxinming can you provide an example using vite-plugin-react-refresh?

fengxinming commented 3 years ago

@imjordanxd

import reactRefresh from 'vite-plugin-react-refresh';

export default function () {
  return defineConfig({
    plugins: [
      reactRefresh({
        parserPlugins: [
          // ...
        ],
        transformPlugins: [
          'babel-plugin-jsx-advanced'
          // ...
        ]
      })
    ]
  });
}
fengxinming commented 3 years ago

@imjordanxd

import reactRefresh from 'vite-plugin-react-refresh';

export default function () {
  return defineConfig({
    plugins: [
      reactRefresh({
        parserPlugins: [
          // ...
        ],
        transformPlugins: [
          'babel-plugin-jsx-advanced'
          // ...
        ]
      })
    ]
  });
}
fengxinming commented 3 years ago

@imjordanxd A part of code in @vitejs/plugin-react-refresh

const result = transformSync(code, {
  parserOpts: {
    plugins: [
      // ...opts.parserPlugins
    ]
  },
  plugins: [
    // ...opts.transformPlugins
  ]
})