import { Compiler } from "webpack"; interface MagicCommentHandlerConfig { test: string | RegExp; handler: (request: string, comment: string) => string; /** * By default, webpack will transform `require.resolve` such that it always returns a module identifier that can then be used with `require` later. * This normally makes sense, but when using a loader that transforms assets into js modules that export a filepath (such as file-loader), * it can be more idiomatic to convert a `require.resolve` to just `require`. * * For example, if a handler were to transform: * ``` * const x = require.resolve(/* foo */"bar.txt"); * // to: * const x = require.resolve("file-loader!bar.txt"); * ``` * Then `x` would just be a webpack module ID (usually a number). * However, with `convertResolve: true`, you can transform that same original `require.resolve` statement to: * ``` * const x = require("file-loader!bar.txt"); * ``` * In which case `x` will be the path to bar.txt in the output directory. */ convertResolve?: boolean; } /** * General purpose webpack plugin for using "magic comments" to change the argument ("request" in webpack terminology) of a `require` or `require.resolve` statement. * * For example, using: * ``` * new RequireMagicCommentsPlugin([ * { test: /foo/, handler: (request) => request + "?foo" }, * ]), * ``` * * Will result in webpack treating `require(/* foo */"bar")` as if it had been `require("bar?foo")`. */ export declare class RequireMagicCommentsPlugin { private _configs; constructor(_configs: MagicCommentHandlerConfig[]); apply(compiler: Compiler): void; private testComment; private handleCommonJs; } export declare const addExternalPrefix: (req: string) => string; export declare const handlePrefixedExternals: (_ctx: any, request: string, cb: any) => void; export declare const addCopyFilesSuffix: (req: string) => string; export declare const copyFilesRule: { resourceQuery: RegExp; loader: string; options: { name: string; postTransformPublicPath: (p: string) => string; }; }; export {}; //# sourceMappingURL=RequireMagicCommentsPlugin.d.ts.map