22 lines
502 B
JavaScript
22 lines
502 B
JavaScript
/**
|
|
* Get current bundler name
|
|
*
|
|
* 获取当前打包器名称
|
|
*
|
|
* @param app - VuePress Node App / VuePress Node 应用
|
|
*
|
|
* @returns The bundler name / 打包器名称
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* // With @vuepress/bundler-vite
|
|
* getBundlerName(app) // 'vite'
|
|
* // With @vuepress/bundler-webpack
|
|
* getBundlerName(app) // 'webpack'
|
|
* ```
|
|
*/
|
|
export const getBundlerName = (app) => {
|
|
const { name } = app.options.bundler;
|
|
return name.match(/^@vuepress\/bundler-(.*)$/)?.[1] || name;
|
|
};
|