W3cubDocs

/webpack

Templates

MainTemplate

startup(source, module, hash)

compilation.mainTemplate.plugin('startup', function(source, module, hash) {
  if (!module.chunks.length && source.indexOf('__ReactStyle__') === -1) {
    var originName = module.origins && module.origins.length ? module.origins[0].name : 'main';
    return [
      'if (typeof window !== "undefined") {',
        '  window.__ReactStyle__ = ' + JSON.stringify(classNames[originName]) + ';',
      '}'
    ].join('\n') + source;
  }
  return source;
});

ModuleTemplate

Document the ModuleTemplate...

ChunkTemplate

Document the ChunkTemplate...

FunctionModuleTemplate

Document the FunctionModuleTemplate...

HotUpdateChunkTemplate

Document the HotUpdateChunkTemplate...

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/api/template