|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
867 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Tobias Koppers @sokra
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const NormalModule = require("./NormalModule");
|
|---|
| 9 |
|
|---|
| 10 | /** @typedef {import("./Compiler")} Compiler */
|
|---|
| 11 |
|
|---|
| 12 | const PLUGIN_NAME = "LoaderTargetPlugin";
|
|---|
| 13 |
|
|---|
| 14 | class LoaderTargetPlugin {
|
|---|
| 15 | /**
|
|---|
| 16 | * Creates an instance of LoaderTargetPlugin.
|
|---|
| 17 | * @param {string} target the target
|
|---|
| 18 | */
|
|---|
| 19 | constructor(target) {
|
|---|
| 20 | this.target = target;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | /**
|
|---|
| 24 | * Applies the plugin by registering its hooks on the compiler.
|
|---|
| 25 | * @param {Compiler} compiler the compiler instance
|
|---|
| 26 | * @returns {void}
|
|---|
| 27 | */
|
|---|
| 28 | apply(compiler) {
|
|---|
| 29 | compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|---|
| 30 | NormalModule.getCompilationHooks(compilation).loader.tap(
|
|---|
| 31 | PLUGIN_NAME,
|
|---|
| 32 | (loaderContext) => {
|
|---|
| 33 | loaderContext.target = this.target;
|
|---|
| 34 | }
|
|---|
| 35 | );
|
|---|
| 36 | });
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | module.exports = LoaderTargetPlugin;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.