|
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:
843 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Gets current bundle's global scope identifier for React Refresh.
|
|---|
| 3 | * @param {Record<string, string>} runtimeGlobals The Webpack runtime globals.
|
|---|
| 4 | * @returns {string} The React Refresh global scope within the Webpack bundle.
|
|---|
| 5 | */
|
|---|
| 6 | module.exports.getRefreshGlobalScope = (runtimeGlobals) => {
|
|---|
| 7 | return `${runtimeGlobals.require || '__webpack_require__'}.$Refresh$`;
|
|---|
| 8 | };
|
|---|
| 9 |
|
|---|
| 10 | /**
|
|---|
| 11 | * Gets current Webpack version according to features on the compiler instance.
|
|---|
| 12 | * @param {import('webpack').Compiler} compiler The current Webpack compiler instance.
|
|---|
| 13 | * @returns {number} The current Webpack version.
|
|---|
| 14 | */
|
|---|
| 15 | module.exports.getWebpackVersion = (compiler) => {
|
|---|
| 16 | if (!compiler.hooks) {
|
|---|
| 17 | throw new Error(`[ReactRefreshPlugin] Webpack version is not supported!`);
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | // Webpack v5+ implements compiler caching
|
|---|
| 21 | return 'cache' in compiler ? 5 : 4;
|
|---|
| 22 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.