1.0.3 • Published 4 years ago

vite-plugin-resolver v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

vite-plugin-resolver

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