Skip to content

Commit

Permalink
fix: remove webpack-inject-plugin dependency
Browse files Browse the repository at this point in the history
As mentioned in #454
  • Loading branch information
Andrew Richardson authored and tobias-93 committed Dec 12, 2023
1 parent 901768b commit 23b8ec9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 1 addition & 4 deletions Resources/package.json
Expand Up @@ -34,8 +34,8 @@
"google-closure-library": "^20220104.0.0",
"gulp": "^4.0.2",
"gulp-rename": "^2.0.0",
"gulp-uglify": "^3.0.2",
"gulp-typescript": "^6.0.0-alpha.1",
"gulp-uglify": "^3.0.2",
"gulp-wrap": "^0.15.0",
"jasmine": "^4.0.2",
"tsd": "^0.19.1",
Expand All @@ -47,8 +47,5 @@
"test": "npm run build && npm run test:types && phantomjs js/run_jsunit.js js/router_test.html",
"test:types": "tsd",
"prepublish": "npm run build"
},
"dependencies": {
"webpack-inject-plugin": "^1.5.5"
}
}
19 changes: 12 additions & 7 deletions Resources/webpack/FosRouting.js
Expand Up @@ -4,8 +4,7 @@
const fs = require('fs');
const path = require('path');
const util = require('util');

const InjectPlugin = require('webpack-inject-plugin').default;
const webpack = require("webpack");

const execFile = util.promisify(require('child_process').execFile);
const readFile = util.promisify(fs.readFile);
Expand Down Expand Up @@ -90,11 +89,17 @@ class FosRouting {
}
});

new InjectPlugin(() => {
return 'import Routing from "fos-router";' +
'import routes from '+JSON.stringify(this.finalTarget)+';' +
'Routing.setRoutingData(routes);';
}).apply(compiler);
new webpack.BannerPlugin({
entryOnly: true,
include: this.finalTarget ? this.finalTarget + ".js" : /\.js$/,
raw: true,
banner:
'import Routing from "fos-router";' +
"import routes from " +
JSON.stringify(this.finalTarget) +
";" +
"Routing.setRoutingData(routes);",
}).apply(compiler);
}
}

Expand Down

0 comments on commit 23b8ec9

Please sign in to comment.