Skip to content

Commit 770cb42

Browse files
Basstertobias-93
authored andcommitted
add skipCompile option to webpack plugin.
This way you can compile the finalTarget e.g. in a separate process and don't need php during compile time.
1 parent 77de7e4 commit 770cb42

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Resources/webpack/FosRouting.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class FosRouting {
1919
prettyPrint: false,
2020
domain: [],
2121
php: 'php',
22+
skipCompile: false
2223
};
2324

2425
constructor(options = {}) {
@@ -29,6 +30,7 @@ class FosRouting {
2930
if (this.options.target === this.finalTarget) {
3031
this.options.target += '.tmp';
3132
}
33+
this.compile = false === this.options.skipCompile;
3234
}
3335

3436
// Values don't need to be escaped because node already does that
@@ -81,14 +83,17 @@ class FosRouting {
8183
}
8284
callback();
8385
};
84-
compiler.hooks.beforeRun.tapAsync('RouteDump', compile);
85-
compiler.hooks.watchRun.tapAsync('RouteDump_Watch', (comp, callback) => {
86-
if (!comp.modifiedFiles || !comp.modifiedFiles.has(this.finalTarget)) {
87-
compile(comp, callback);
88-
} else {
89-
callback();
90-
}
91-
});
86+
87+
if (this.compile) {
88+
compiler.hooks.beforeRun.tapAsync('RouteDump', compile);
89+
compiler.hooks.watchRun.tapAsync('RouteDump_Watch', (comp, callback) => {
90+
if (!comp.modifiedFiles || !comp.modifiedFiles.has(this.finalTarget)) {
91+
compile(comp, callback);
92+
} else {
93+
callback();
94+
}
95+
});
96+
}
9297

9398
new InjectPlugin(() => {
9499
return 'import Routing from "fos-router";' +

0 commit comments

Comments
 (0)