1 | const Dependency = require('webpack/lib/Dependency');
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | class 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 |
|
21 | class 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 |
|
35 | module.exports = GoogLoaderEs6SuffixDependency;
|
36 | module.exports.Template = GoogLoaderes6SuffixDependencyTemplate;
|