Skip to content

Latest commit

 

History

History
66 lines (47 loc) · 1.28 KB

README.md

File metadata and controls

66 lines (47 loc) · 1.28 KB

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(),
  ]
}