New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-lazy-import

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-lazy-import - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

6

dist/index.js

@@ -19,2 +19,3 @@ (function (global, factory) {

});
exports.kebabCase = void 0;
exports.lazyImport = lazyImport;

@@ -77,2 +78,3 @@ var _esModuleLexer = require("es-module-lexer");

}
var kebabCase = exports.kebabCase = _xeUtils["default"].kebabCase;
function lazyImport(options) {

@@ -117,4 +119,4 @@ var opts = Object.assign({

var extName = resOpts.importStyle === true ? 'css' : resOpts.importStyle || 'css';
jsPath = "import { ".concat(name, " } from \"").concat(resOpts.lib, "/").concat(libDir, "/").concat(_xeUtils["default"].kebabCase(importName), "/index.js\"");
stylePath = "import \"".concat(resOpts.lib, "/").concat(libDir, "/").concat(_xeUtils["default"].kebabCase(importName), "/style.").concat(extName, "\"");
jsPath = "import { ".concat(name, " } from \"").concat(resOpts.lib, "/").concat(libDir, "/").concat(kebabCase(importName), "/index.js\"");
stylePath = "import \"".concat(resOpts.lib, "/").concat(libDir, "/").concat(kebabCase(importName), "/style.").concat(extName, "\"");
if (resOpts.resolve) {

@@ -121,0 +123,0 @@ var rest = resOpts.resolve({

{
"name": "vite-plugin-lazy-import",
"version": "0.3.0",
"version": "0.4.0",
"description": "Used for vite Lazy import js and style",

@@ -5,0 +5,0 @@ "scripts": {

@@ -5,4 +5,68 @@ # vite-plugin-lazy-import

## Installation
```shell
npm install vite-plugin-lazy-import -D
```
```javascript
// vite.config.ts
import { lazyImport } from 'vite-plugin-lazy-import'
export default defineConfig({
// ...
plugins: [
lazyImport({
resolvers: [
{ lib: 'vxe-pc-ui', importStyle: 'css', esm: true }
]
})
]
// ...
})
```
## Usage
```javascript
// main.ts
// ...
import { VxeUI, VxeButton } from 'vxe-pc-ui'
//...
VxeUI.setConfig({})
createApp(App).use(VxeButton).mount('#app')
```
into this
```javascript
// main.ts
// ...
import { VxeUI } from 'vxe-pc-ui/es/vxe-ui/index.js'
import { VxeButton } from 'vxe-pc-ui/es/vxe-button/index.js'
//...
VxeUI.setConfig({})
createApp(App).use(VxeButton).mount('#app')
```
```javascript
lazyImport({
resolvers: [
{
lib: 'vxe-pc-ui',
importStyle: 'css',
resolve ({ name }) {
return
}
}
]
})
```
## License
[MIT](LICENSE) © 2019-present, Xu Liangzhan
import { Plugin, FilterPattern } from 'vite'
import { kebabCase as kebabCaseMethod } from 'xe-utils'

@@ -25,2 +26,4 @@ export interface LazyImportResolverResult {

export const kebabCase = kebabCaseMethod
export function lazyImport (options: LazyImportConfig): Plugin<any>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc