UNPKG

798 BJavaScriptView Raw
1const Dependency = require('webpack/lib/Dependency');
2
3/**
4 * Cleans up after the prefix dependency.
5 */
6class GoogLoaderEs6SuffixDependency extends Dependency {
7 constructor(insertPosition) {
8 super();
9 this.insertPosition = insertPosition;
10 }
11
12 get type() {
13 return 'goog loader es6 suffix';
14 }
15
16 updateHash(hash) {
17 hash.update(this.insertPosition + '');
18 }
19}
20
21class GoogLoaderes6SuffixDependencyTemplate {
22 apply(dep, source) {
23 if (dep.insertPosition === null) {
24 return;
25 }
26
27 source.insert(
28 dep.insertPosition,
29 `$jscomp.getCurrentModulePath = function() { return null; };
30$jscomp.require = function() { return null; };`
31 );
32 }
33}
34
35module.exports = GoogLoaderEs6SuffixDependency;
36module.exports.Template = GoogLoaderes6SuffixDependencyTemplate;