diff --git a/Resources/package.json b/Resources/package.json index 3a71964..0d2e198 100755 --- a/Resources/package.json +++ b/Resources/package.json @@ -1,6 +1,6 @@ { "name": "fos-router", - "version": "2.4.3", + "version": "2.4.6", "description": "A pretty nice way to use the routes generated by the FOSJsRoutingBundle in your JavaScript.", "keywords": [ "router", diff --git a/Resources/webpack/FosRouting.js b/Resources/webpack/FosRouting.js index f224c79..e99ff1a 100644 --- a/Resources/webpack/FosRouting.js +++ b/Resources/webpack/FosRouting.js @@ -64,15 +64,20 @@ class FosRouting { return pass; }, []); await execFile(this.options.php, ['bin/console', 'fos:js-routing:dump', ...args]); - const content = await readFile(this.options.target); - await rmFile(this.options.target); - if (!prevContent || content.compare(prevContent) !== 0) { - await makeDir(path.dirname(this.finalTarget), {recursive: true}); - await writeFile(this.finalTarget, content); - prevContent = content; - if (comp.modifiedFiles && !comp.modifiedFiles.has(this.finalTarget)) { - comp.modifiedFiles.add(this.finalTarget); + try { + const content = await readFile(this.options.target); + await rmFile(this.options.target); + if (!prevContent || content.compare(prevContent) !== 0) { + await makeDir(path.dirname(this.finalTarget), {recursive: true}); + await writeFile(this.finalTarget, content); + prevContent = content; + if (comp.modifiedFiles && !comp.modifiedFiles.has(this.finalTarget)) { + comp.modifiedFiles.add(this.finalTarget); + } } + } catch (e) { + const logger = compiler.getInfrastructureLogger('FosRouting'); + logger.error(e.toString()); } callback(); };