source: trip-planner-front/node_modules/webpack/lib/dependencies/RequireIncludePlugin.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const RequireIncludeDependency = require("./RequireIncludeDependency");
9const RequireIncludeDependencyParserPlugin = require("./RequireIncludeDependencyParserPlugin");
10
11class RequireIncludePlugin {
12 apply(compiler) {
13 compiler.hooks.compilation.tap(
14 "RequireIncludePlugin",
15 (compilation, { normalModuleFactory }) => {
16 compilation.dependencyFactories.set(
17 RequireIncludeDependency,
18 normalModuleFactory
19 );
20 compilation.dependencyTemplates.set(
21 RequireIncludeDependency,
22 new RequireIncludeDependency.Template()
23 );
24
25 const handler = (parser, parserOptions) => {
26 if (parserOptions.requireInclude === false) return;
27 const warn = parserOptions.requireInclude === undefined;
28
29 new RequireIncludeDependencyParserPlugin(warn).apply(parser);
30 };
31
32 normalModuleFactory.hooks.parser
33 .for("javascript/auto")
34 .tap("RequireIncludePlugin", handler);
35 normalModuleFactory.hooks.parser
36 .for("javascript/dynamic")
37 .tap("RequireIncludePlugin", handler);
38 }
39 );
40 }
41}
42module.exports = RequireIncludePlugin;
Note: See TracBrowser for help on using the repository browser.