vite-plugin-externals
Advanced tools
Comparing version 0.1.7 to 0.2.0
@@ -26,5 +26,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { | ||
if (useWindow === false) { | ||
return externalValue; | ||
return typeof externalValue === 'string' ? externalValue : externalValue.join('.'); | ||
} | ||
return `window['${externalValue}']`; | ||
if (typeof externalValue === 'string') { | ||
return `window['${externalValue}']`; | ||
} | ||
const vals = externalValue.map((val) => `['${val}']`).join(''); | ||
return `window${vals}`; | ||
}; | ||
@@ -31,0 +35,0 @@ })((_a = userOptions.useWindow) !== null && _a !== void 0 ? _a : true); |
import { TransformPluginContext } from 'rollup'; | ||
export declare type Externals = Record<string, string>; | ||
export declare type ExternalValue = string | string[]; | ||
export declare type Externals = Record<string, ExternalValue>; | ||
export interface Options { | ||
@@ -4,0 +5,0 @@ disableSsr?: boolean; |
@@ -32,5 +32,9 @@ "use strict"; | ||
if (useWindow === false) { | ||
return externalValue; | ||
return typeof externalValue === 'string' ? externalValue : externalValue.join('.'); | ||
} | ||
return `window['${externalValue}']`; | ||
if (typeof externalValue === 'string') { | ||
return `window['${externalValue}']`; | ||
} | ||
const vals = externalValue.map((val) => `['${val}']`).join(''); | ||
return `window${vals}`; | ||
}; | ||
@@ -37,0 +41,0 @@ })((_a = userOptions.useWindow) !== null && _a !== void 0 ? _a : true); |
import { TransformPluginContext } from 'rollup'; | ||
export declare type Externals = Record<string, string>; | ||
export declare type ExternalValue = string | string[]; | ||
export declare type Externals = Record<string, ExternalValue>; | ||
export interface Options { | ||
@@ -4,0 +5,0 @@ disableSsr?: boolean; |
{ | ||
"name": "vite-plugin-externals", | ||
"version": "0.1.7", | ||
"version": "0.2.0", | ||
"description": "externals plugin for vite", | ||
@@ -5,0 +5,0 @@ "author": "crcong", |
@@ -41,2 +41,4 @@ # vite-plugin-externals | ||
'react-dom': 'ReactDOM', | ||
// value support chain, tranform to window['React']['lazy'] | ||
lazy: ['React', 'lazy'] | ||
}), | ||
@@ -43,0 +45,0 @@ ] |
@@ -41,2 +41,4 @@ # vite-plugin-externals | ||
'react-dom': 'ReactDOM', | ||
// 支持值链式取值,会转换成 window['React']['lazy'] | ||
lazy: ['React', 'lazy'] | ||
}), | ||
@@ -43,0 +45,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25239
377
137