source: trip-planner-front/node_modules/webpack/lib/SourceMapDevToolModuleOptionsPlugin.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.3 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 JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
9
10/** @typedef {import("./Compilation")} Compilation */
11
12class SourceMapDevToolModuleOptionsPlugin {
13 constructor(options) {
14 this.options = options;
15 }
16
17 /**
18 * @param {Compilation} compilation the compiler instance
19 * @returns {void}
20 */
21 apply(compilation) {
22 const options = this.options;
23 if (options.module !== false) {
24 compilation.hooks.buildModule.tap(
25 "SourceMapDevToolModuleOptionsPlugin",
26 module => {
27 module.useSourceMap = true;
28 }
29 );
30 compilation.hooks.runtimeModule.tap(
31 "SourceMapDevToolModuleOptionsPlugin",
32 module => {
33 module.useSourceMap = true;
34 }
35 );
36 } else {
37 compilation.hooks.buildModule.tap(
38 "SourceMapDevToolModuleOptionsPlugin",
39 module => {
40 module.useSimpleSourceMap = true;
41 }
42 );
43 compilation.hooks.runtimeModule.tap(
44 "SourceMapDevToolModuleOptionsPlugin",
45 module => {
46 module.useSimpleSourceMap = true;
47 }
48 );
49 }
50 JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap(
51 "SourceMapDevToolModuleOptionsPlugin",
52 () => true
53 );
54 }
55}
56
57module.exports = SourceMapDevToolModuleOptionsPlugin;
Note: See TracBrowser for help on using the repository browser.