1 | 'use strict';
|
2 |
|
3 | var fs = require('fs');
|
4 | var path = require('path');
|
5 | var script = fs.readFileSync(path.resolve(__dirname, './globScript.js'));
|
6 |
|
7 | function injectScript() {}
|
8 |
|
9 | injectScript.prototype.apply = function (compiler) {
|
10 | compiler.plugin('emit', function (compilation, callback) {
|
11 | compilation.chunks.forEach(function (chunk) {
|
12 | chunk.files.forEach(function (filename) {
|
13 | if (filename === 'vendor.js') {
|
14 | compilation.assets[filename].children.forEach(function (child) {
|
15 | if (child._value) {
|
16 | child._value = script + child._value;
|
17 | }
|
18 | });
|
19 | }
|
20 | });
|
21 | });
|
22 | callback();
|
23 | });
|
24 | };
|
25 |
|
26 | module.exports = injectScript; |
\ | No newline at end of file |