Skip to content

a tiny vite-plugin-resolver for external, generateRoute etc.

Notifications You must be signed in to change notification settings

yuyuabc1/vite-plugin-resolver

Repository files navigation

vite-plugin-resolver

NPM package

English | 中文

Provide some plug-ins required on vite parser, and now realize the following functions 1.Make vite work normally in webpackexternalsExternal dependencies in configuration items 2.Solve the problem that the JSX file in vite fails to parse due to the loss of Lang tag

用法

npm i vite-plugin-resolver -D

All methods are configured in vite.config.js

externals

import { externals } from 'vite-plugin-resolver'
export default {
  plugins: [
    // externals(/* options */)
    externals({
      vue: 'Vue',
      react: 'React',
      'react-dom': 'ReactDOM',
    }),
  ]
}

Options

externals

Type: Object

Default: { externals: Record<String, String> }

options

Type: String

Default: 'esm' | 'cjs'

esm will generate code - const vue = window['Vue']; export { vue as default }; cjs will generate code - const vue = window['Vue']; module.exports = vue;

andlang

import { andLang } from 'vite-plugin-resolver'
export default {
  plugins: [
    andLang(),
  ]
}

About

a tiny vite-plugin-resolver for external, generateRoute etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published