UNPKG

1.48 kBTypeScriptView Raw
1import * as webpack from 'webpack';
2import { LocaleId } from '../index';
3
4/**
5 * _仅服务器端_
6 *
7 * 读取目标文件的内容
8 *
9 * 该文件必须为客户端打包结果
10 */
11function readClientFile(
12 /** 要查找的文件的文件名。根据打包文件对应表 (chunkmap) 查询文件名和实际打包结果文件的对应关系 */
13 filename: string,
14 /** 对应语种。默认为当前语种 (i18n开启时) */
15 localeId?: LocaleId,
16 /** Webpack compilation 对象。如果提供,直接从 compilation 对象中抽取结果 */
17 compilation?: webpack.compilation.Compilation,
18 /** 如果标记为 true,表示提供的 filename 为确切的相对于客户端打包根目录的文件路径,无需查询对照表,直接返回结果 */
19 isPathname?: boolean
20): string;
21function readClientFile(
22 /** 表示提供的 filename 为确切的相对于客户端打包根目录的文件路径,无需查询对照表,直接返回结果 */
23 isPathname?: true,
24 /** 要查找的文件的文件名。根据打包文件对应表 (chunkmap) 查询文件名和实际打包结果文件的对应关系 */
25 filename: string,
26 /** 对应语种。默认为当前语种 (i18n开启时) */
27 localeId?: LocaleId,
28 /** Webpack compilation 对象。如果提供,直接从 compilation 对象中抽取结果 */
29 compilation?: webpack.compilation.Compilation
30): string;
31
32export default readClientFile;