import type { MixinModule } from '../../scripts/mf-modules'; import CopyPlugin from 'copy-webpack-plugin'; import webpack from 'webpack'; interface WebpackContextInfo { /** * ├── dist * | ├── logo.svg * │ ├── modules * │ │ ├── ones-performance-vm21 * │ │ │ └── ones-performance-yxEb * │ │ │ └── index.html * │ ├── ones-performance-yxEb.28bf16.js * │ ├── ones-performance-yxEb.8c5b22.css * * This is the file structure of the plugin project after the build. The base path of the plugin is the * `modules/ones-performance-vm21/ones-performance-yxEb`. If the plugin wants to load the static script, it needs * to back to the `dist` directory. So the `publicPath` of the plugin is `../../../`. * * But in the dev hot update server, the server fetches the JSON file with relative URL, the browser completes the URL * with the ONES Project IP, the dev server is different from the ONES Project IP, so the `publicPath` should be the * absolute URL of the server(MF doesn't patch `fetch`). * * In summary, the `publicPath` of the plugin is the absolute URL in the dev server(for example, `127.0.0.1:3000`), * and is the relative URL in the ONES Project(for example: `../../../`). * * #312088 插件web工程构建,webpack热更新存在问题 * https://our.ones.pro/project/#/team/RDjYMhKq/task/Xa7wVTYoyt658OK3 * * Because the plugin project tries to load `modules/ones-performance-vm21/ones-performance-yxEb/ones-performance-yxEb.886d40.hot-update.json`, * but the right URL is `./ones-performance-yxEb.886d40.hot-update.json`. */ getPublicPath?: () => string; appID: string; } declare function getExtendEntriesAndPlugin(modules: MixinModule[], contextInfo: WebpackContextInfo): { entries: webpack.EntryObject; plugins: (((this: webpack.Compiler, compiler: webpack.Compiler) => void) | webpack.WebpackPluginInstance)[]; }; declare function getDefaultWebpackConfig(modules: MixinModule[], currentWorkingDirectory: string, contextInfo: WebpackContextInfo): { entry: webpack.EntryObject; context: string; output: { path: string; clean: boolean; assetModuleFilename: string; chunkFilename: string; hashDigestLength: number; publicPath: string; }; module: { rules: ({ test: RegExp; use: { loader: string; options: { cwd: string; exclude: string; presets: (string | (string | { modules: boolean; })[])[]; plugins: (string | { corejs: number; useESModules: boolean; })[][]; }; }; type?: undefined; parser?: undefined; } | { test: RegExp; use: ({ loader: string; options?: undefined; } | { loader: string; options: { postcssOptions: any; }; })[]; type?: undefined; parser?: undefined; } | { test: RegExp; use: { loader: string; options: { memo: boolean; }; }[]; type?: undefined; parser?: undefined; } | { test: RegExp; type: string; parser: { dataUrlCondition: { maxSize: number; }; }; use?: undefined; })[]; }; resolve: { extensions: string[]; }; plugins: (CopyPlugin | ((this: webpack.Compiler, compiler: webpack.Compiler) => void) | webpack.WebpackPluginInstance)[]; }; declare function buildPluginProjectFrontEnd(currentWorkingDirectory?: string): Promise; export { getExtendEntriesAndPlugin, getDefaultWebpackConfig, buildPluginProjectFrontEnd }; //# sourceMappingURL=frontend.d.ts.map