import type webpack from 'webpack'; import type { Terminal as _Terminal } from '@rushstack/terminal'; import type webpackPlugin from '@rushstack/heft-webpack5-plugin'; import type { IExternalProject, IReferencedProjectMap, CumulativeManifestProcessor as _CumulativeManifestProcessor } from '@microsoft/spfx-heft-plugins'; /** * Discovers and configures linked SharePoint Framework external dependencies. * * This function scans the project structure to find linked SPFx projects and their manifests, * then creates the necessary configuration for webpack externals. It processes referenced * projects to extract external dependencies that should not be bundled but loaded at runtime. * * @param terminal - Terminal instance for logging output during manifest discovery * @param rootPath - Root path of the project to scan for manifests * * @returns An object containing: * - `referencedProjects`: Map of discovered project manifests organized by ID and version * - `cumulativeManifestProcessor`: Processor instance for handling manifest operations * - `linkedExternals`: Map of external package names to their project metadata * - `externals`: Set of external package names for webpack configuration * * @example * ```typescript * const { linkedExternals, externals } = getLinkedSPFxExternals(terminal, __dirname); * // linkedExternals: Map { '@my/package' => { id: 'abc123', name: '@my/package', version: '1.0.0' } } * // externals: Set { '@my/package', '@another/package' } * ``` */ export declare function getLinkedSPFxExternals(terminal: _Terminal, rootPath: string): { referencedProjects: IReferencedProjectMap; cumulativeManifestProcessor: _CumulativeManifestProcessor; linkedExternals: Map; externals: webpack.Configuration['externals']; }; export declare function getSPFxWebpackConfig({ production }: webpackPlugin.IWebpackConfigurationFnEnvironment): { terminal: _Terminal; plugins: webpack.WebpackPluginInstance[]; entry: webpack.Configuration['entry']; alias: webpack.ResolveOptions['alias']; externals: webpack.Configuration['externals']; }; /** * Generates a SharePoint Framework (SPFx) webpack configuration for building web parts and extensions. * * This function creates a specialized webpack configuration tailored for SPFx development that: * - Configures AMD module output format required by SharePoint's module loader * - Integrates SPFx-specific plugins for manifest generation and localization * - Sets up TypeScript compilation with transpile-only mode for faster builds * - Handles localization (.resjson) files for internationalization support * - Configures SCSS/CSS processing with Sass support and node_modules resolution * - Sets up asset handling for images, fonts, and media files * - Manages external dependencies and linked SPFx projects * - Configures webpack resolve aliases for localization strings * * The configuration differs from standard React/web apps by: * - Using AMD instead of CommonJS/ESM module format * - Including SharePoint manifest generation * - Supporting SPFx localization patterns * - Handling linked SPFx project externals * - Using SPFx-specific file naming conventions with locale and content hash * * @param env - Webpack configuration environment containing production flag and other build settings * @returns Complete webpack configuration object ready for SPFx component building * * @example * ```typescript * // Used by webpack to build SPFx components * const config = generateConfig({ production: true }); * // Results in AMD modules loadable by SharePoint with proper manifests * ``` */ export default function generateConfig(env: webpackPlugin.IWebpackConfigurationFnEnvironment): webpack.Configuration; //# sourceMappingURL=webpack.config.d.ts.map