atlassian-webresource-webpack-plugin
Version:
Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.
36 lines • 1.68 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ExternalModule_1 = __importDefault(require("webpack/lib/ExternalModule"));
/**
* ProvidedExternalModule ensures that the `chunkCondition` is true to allow proper asyncChunk context handling
* ExternalModules can be defined in different ways. Some of them require the external module to be loaded in the entry point.
* This is generally not bad as it doesnt cost anything. However the WRM Plugin relies on ExternalModules to specify provided dependencies.
* These provided dependencies are then added to the context of the chunk in which they occur. Async chunks should therefore
* have their own dependencies to make the entrypoint as small as possible.
* ProvidedExternalModule ensures that.
*/
class ProvidedExternalDependencyModule extends ExternalModule_1.default {
constructor(request, dependency, target) {
super(request, target);
this._request = request;
this._wrmDependency = dependency;
this._target = target;
}
libIdent() {
return `${this._wrmDependency}/${typeof this._request === 'string' ? this._request : this._request[this._target]}`;
}
chunkCondition() {
return true;
}
getDependency() {
return this._wrmDependency;
}
getConcatenationBailoutReason() {
return `Provided external dependencies can't be concatenated`;
}
}
exports.default = ProvidedExternalDependencyModule;
//# sourceMappingURL=ProvidedExternalDependencyModule.js.map
;