Skip to content

Commit

Permalink
Revert "fix: remove webpack-inject-plugin dependency"
Browse files Browse the repository at this point in the history
This reverts commit 23b8ec9.
  • Loading branch information
tobias-93 authored Dec 15, 2023
1 parent 80835fe commit c61c92d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
5 changes: 4 additions & 1 deletion Resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"google-closure-library": "^20220104.0.0",
"gulp": "^4.0.2",
"gulp-rename": "^2.0.0",
"gulp-typescript": "^6.0.0-alpha.1",
"gulp-uglify": "^3.0.2",
"gulp-typescript": "^6.0.0-alpha.1",
"gulp-wrap": "^0.15.0",
"jasmine": "^4.0.2",
"tsd": "^0.19.1",
Expand All @@ -47,5 +47,8 @@
"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: 7 additions & 12 deletions Resources/webpack/FosRouting.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
const fs = require('fs');
const path = require('path');
const util = require('util');
const webpack = require("webpack");

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

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

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);
new InjectPlugin(() => {
return 'import Routing from "fos-router";' +
'import routes from '+JSON.stringify(this.finalTarget)+';' +
'Routing.setRoutingData(routes);';
}).apply(compiler);
}
}

Expand Down

0 comments on commit c61c92d

Please sign in to comment.