$ yarn add vite-plugin-cdn2 -D
# or
$ npm install vite-plugin-cdn2 -D
// vite.config.ts
import { defineConfig } from 'vite'
import { cdn } from 'vite-plugin-cdn2'
export default defineConfig({
plugins: [
// ... your plugin
cdn({ modules: ['vue'] })
]
})
Type:
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null
Default: /\.(mjs|js|ts|vue|jsx|tsx)(\?.*|)$/
Include all assets matching any of these conditions.
Type:
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null
Default: undefined
Exclude all assets matching any of these conditions.
Type:
interface TrackModule {
name: string
global?: string
spare?: Array<string> | string
relativeModule?: string
}
type ResolverFunction = (p: string, extra: IIFEModuleInfo)=> string
interface IModule extends TrackModule{
resolve: string | ResolverFunction
}
type Modules = Array<IModule | string>
Default: []
Modules to be processed. Details see Modules.
Type: string
Default: https://cdn.jsdelivr.net/npm/
CDN url. Details see URL.
Type:
interface InjectVisitor {
script?: (node: ScriptNode)=> void
link?: (node: LinkNode)=> void
}
type Trasnform = ()=> InjectVisitor
Default: undefined
Transform is a overwrite.
Type: slient
| warn
Default: warn
Adjust console output verbosity.
Type: ResolverFunction
Default: undefined
A global url parser.
Type: build
| serve
Default: build
Same as vite command
Thanks to JetBrains for allocating free open-source licences for IDEs such as WebStorm.
Kanno