source: imaps-frontend/node_modules/webpack/lib/SourceMapDevToolModuleOptionsPlugin.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.5 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("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
11/** @typedef {import("./Compilation")} Compilation */
12
13class SourceMapDevToolModuleOptionsPlugin {
14 /**
15 * @param {SourceMapDevToolPluginOptions} options options
16 */
17 constructor(options) {
18 this.options = options;
19 }
20
21 /**
22 * @param {Compilation} compilation the compiler instance
23 * @returns {void}
24 */
25 apply(compilation) {
26 const options = this.options;
27 if (options.module !== false) {
28 compilation.hooks.buildModule.tap(
29 "SourceMapDevToolModuleOptionsPlugin",
30 module => {
31 module.useSourceMap = true;
32 }
33 );
34 compilation.hooks.runtimeModule.tap(
35 "SourceMapDevToolModuleOptionsPlugin",
36 module => {
37 module.useSourceMap = true;
38 }
39 );
40 } else {
41 compilation.hooks.buildModule.tap(
42 "SourceMapDevToolModuleOptionsPlugin",
43 module => {
44 module.useSimpleSourceMap = true;
45 }
46 );
47 compilation.hooks.runtimeModule.tap(
48 "SourceMapDevToolModuleOptionsPlugin",
49 module => {
50 module.useSimpleSourceMap = true;
51 }
52 );
53 }
54 JavascriptModulesPlugin.getCompilationHooks(compilation).useSourceMap.tap(
55 "SourceMapDevToolModuleOptionsPlugin",
56 () => true
57 );
58 }
59}
60
61module.exports = SourceMapDevToolModuleOptionsPlugin;
Note: See TracBrowser for help on using the repository browser.