mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-27 15:30:57 +00:00
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
const require_src_plugins_RemotePublicPathRuntimeModule = require('./RemotePublicPathRuntimeModule.js');
|
|
|
|
//#region src/plugins/AutomaticPublicPathPlugin.ts
|
|
var RemotePublicPathPlugin = class {
|
|
constructor(options) {
|
|
this.options = options;
|
|
}
|
|
apply(compiler) {
|
|
const { RuntimeGlobals } = compiler.webpack;
|
|
compiler.hooks.thisCompilation.tap("RemotePublicPathPlugin", (compilation) => {
|
|
compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.publicPath).tap("RuntimePlugin", (chunk, set) => {
|
|
const { outputOptions } = compilation;
|
|
const { publicPath: globalPublicPath, scriptType } = outputOptions;
|
|
const entryOptions = chunk.getEntryOptions();
|
|
const publicPath = entryOptions && entryOptions.publicPath !== void 0 ? entryOptions.publicPath : globalPublicPath;
|
|
const module = new require_src_plugins_RemotePublicPathRuntimeModule.default(this.options);
|
|
if (publicPath === "auto" && scriptType !== "module") set.add(RuntimeGlobals.global);
|
|
else if (typeof publicPath !== "string" || /\[(full)?hash\]/.test(publicPath)) module.fullHash = true;
|
|
compilation.addRuntimeModule(chunk, module);
|
|
return true;
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
//#endregion
|
|
exports.default = RemotePublicPathPlugin;
|
|
//# sourceMappingURL=AutomaticPublicPathPlugin.js.map
|