fuc-new/doc/node_modules/@vuepress/helper/lib/node/bundler/getBundlerName.js
hellcat 6adbc04d4b 1
2025-10-03 17:17:08 +08:00

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;
};