Skip to content

Commit

Permalink
move skipCompile from options to constructir argument, so it won't be…
Browse files Browse the repository at this point in the history
… passed to the php command as argument.
  • Loading branch information
Basster authored and tobias-93 committed Jan 23, 2024
1 parent 770cb42 commit 167ca0e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Resources/webpack/FosRouting.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ class FosRouting {
locale: '',
prettyPrint: false,
domain: [],
php: 'php',
skipCompile: false
php: 'php'
};

constructor(options = {}) {
constructor(options = {}, registerCompileHooks = true) {
this.options = Object.assign({target: 'var/cache/fosRoutes.json'}, this.default, options, {format: 'json'});
this.finalTarget = path.resolve(process.cwd(), this.options.target);
this.options.target = path.resolve(process.cwd(), this.options.target.replace(/\.json$/, '.tmp.json'));

if (this.options.target === this.finalTarget) {
this.options.target += '.tmp';
}
this.compile = false === this.options.skipCompile;
this.registerCompileHooks = registerCompileHooks;
}

// Values don't need to be escaped because node already does that
Expand Down Expand Up @@ -84,7 +83,7 @@ class FosRouting {
callback();
};

if (this.compile) {
if (this.registerCompileHooks === true) {
compiler.hooks.beforeRun.tapAsync('RouteDump', compile);
compiler.hooks.watchRun.tapAsync('RouteDump_Watch', (comp, callback) => {
if (!comp.modifiedFiles || !comp.modifiedFiles.has(this.finalTarget)) {
Expand Down

0 comments on commit 167ca0e

Please # to comment.