Skip to content

Commit 6d8bbb9

Browse files
Andrew Richardsontobias-93
authored andcommitted
fix: remove webpack-inject-plugin dependency
As mentioned in #454
1 parent 901768b commit 6d8bbb9

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Resources/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"google-closure-library": "^20220104.0.0",
3535
"gulp": "^4.0.2",
3636
"gulp-rename": "^2.0.0",
37-
"gulp-uglify": "^3.0.2",
3837
"gulp-typescript": "^6.0.0-alpha.1",
38+
"gulp-uglify": "^3.0.2",
3939
"gulp-wrap": "^0.15.0",
4040
"jasmine": "^4.0.2",
4141
"tsd": "^0.19.1",
@@ -47,8 +47,5 @@
4747
"test": "npm run build && npm run test:types && phantomjs js/run_jsunit.js js/router_test.html",
4848
"test:types": "tsd",
4949
"prepublish": "npm run build"
50-
},
51-
"dependencies": {
52-
"webpack-inject-plugin": "^1.5.5"
5350
}
5451
}

Resources/webpack/FosRouting.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
const fs = require('fs');
55
const path = require('path');
66
const util = require('util');
7-
8-
const InjectPlugin = require('webpack-inject-plugin').default;
7+
const webpack = require("webpack");
98

109
const execFile = util.promisify(require('child_process').execFile);
1110
const readFile = util.promisify(fs.readFile);
@@ -90,11 +89,17 @@ class FosRouting {
9089
}
9190
});
9291

93-
new InjectPlugin(() => {
94-
return 'import Routing from "fos-router";' +
95-
'import routes from '+JSON.stringify(this.finalTarget)+';' +
96-
'Routing.setRoutingData(routes);';
97-
}).apply(compiler);
92+
new webpack.BannerPlugin({
93+
entryOnly: true,
94+
include: this.finalTarget ? this.finalTarget + ".js" : /\.js$/,
95+
raw: true,
96+
banner:
97+
'import Routing from "fos-router";' +
98+
"import routes from " +
99+
JSON.stringify(this.finalTarget) +
100+
";" +
101+
"Routing.setRoutingData(routes);",
102+
}).apply(compiler);
98103
}
99104
}
100105

0 commit comments

Comments
 (0)