|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1003 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | "use strict";
|
|---|
| 6 |
|
|---|
| 7 | const RuntimeGlobals = require("../RuntimeGlobals");
|
|---|
| 8 | const RuntimeModule = require("../RuntimeModule");
|
|---|
| 9 |
|
|---|
| 10 | /** @typedef {import("../../declarations/WebpackOptions").PublicPath} PublicPath */
|
|---|
| 11 | /** @typedef {import("../Compilation")} Compilation */
|
|---|
| 12 |
|
|---|
| 13 | class PublicPathRuntimeModule extends RuntimeModule {
|
|---|
| 14 | /**
|
|---|
| 15 | * @param {PublicPath} publicPath public path
|
|---|
| 16 | */
|
|---|
| 17 | constructor(publicPath) {
|
|---|
| 18 | super("publicPath", RuntimeModule.STAGE_BASIC);
|
|---|
| 19 | /** @type {PublicPath} */
|
|---|
| 20 | this.publicPath = publicPath;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | /**
|
|---|
| 24 | * Generates runtime code for this runtime module.
|
|---|
| 25 | * @returns {string | null} runtime code
|
|---|
| 26 | */
|
|---|
| 27 | generate() {
|
|---|
| 28 | const { publicPath } = this;
|
|---|
| 29 | const compilation = /** @type {Compilation} */ (this.compilation);
|
|---|
| 30 |
|
|---|
| 31 | return `${RuntimeGlobals.publicPath} = ${JSON.stringify(
|
|---|
| 32 | compilation.getPath(publicPath || "", {
|
|---|
| 33 | hash: compilation.hash || "XXXX"
|
|---|
| 34 | })
|
|---|
| 35 | )};`;
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | module.exports = PublicPathRuntimeModule;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.