Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
663 bytes
|
Rev | Line | |
---|
[6a3a178] | 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 | class PublicPathRuntimeModule extends RuntimeModule {
|
---|
| 11 | constructor(publicPath) {
|
---|
| 12 | super("publicPath", RuntimeModule.STAGE_BASIC);
|
---|
| 13 | this.publicPath = publicPath;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | * @returns {string} runtime code
|
---|
| 18 | */
|
---|
| 19 | generate() {
|
---|
| 20 | const { compilation, publicPath } = this;
|
---|
| 21 |
|
---|
| 22 | return `${RuntimeGlobals.publicPath} = ${JSON.stringify(
|
---|
| 23 | compilation.getPath(publicPath || "", {
|
---|
| 24 | hash: compilation.hash || "XXXX"
|
---|
| 25 | })
|
---|
| 26 | )};`;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | module.exports = PublicPathRuntimeModule;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.