MCPcopy
hub / github.com/webpack/webpack / renderChunkImport

Function renderChunkImport

lib/esm/ModuleChunkFormatPlugin.js:80–84  ·  view source on GitHub ↗

* Renders chunk import. * @param {Compilation} compilation the compilation instance * @param {Chunk} chunk the chunk to render the import for * @param {string=} namedImport the named import to use for the import * @param {Chunk=} runtimeChunk the runtime chunk * @returns {string} the import sou

(compilation, chunk, namedImport, runtimeChunk)

Source from the content-addressed store, hash-verified

78 * @returns {string} the import source
79 */
80function renderChunkImport(compilation, chunk, namedImport, runtimeChunk) {
81 return `import ${namedImport ? `* as ${namedImport}` : `{ ${RuntimeGlobals.require} }`} from ${JSON.stringify(
82 getRelativePath(compilation, chunk, runtimeChunk || chunk)
83 )};\n`;
84}
85
86/**
87 * Gets chunk named import.

Callers 2

withDependentChunksMethod · 0.85
applyMethod · 0.85

Calls 1

getRelativePathFunction · 0.85

Tested by

no test coverage detected