You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose onError hook or allow Error config option #577
I then am using gulp-watch (not the build-in gulp.watch), to provide live-reload of assets, etc. However, if there's a syntax error in one of the files rollup is trying to process, I get the following stack trace:
Ideally, I would be able to handle the error from rollup, and not exit my gulp watch process so that I can fix the syntax error and continue with hot/live reload.
Is this a planned future extension? Am I missing something obvious now how to do this?
@nkoterba About gulp3.*. You should catch every "error ready" pipe. And you need just pass native callback to error listener. The last pipe will be always catched. The problem is that errors do not bubble in the pipe. It was fixed in gulp4 which is not released yet, but I still use it.
@TrySound Thanks for the info. I re-did our build system to use straight rollup, babel, etc. as you suggested. Thanks for the clear/clean code example. We were piping our original gulp output to two destinations but a second gulp task allows us the same functionality.
As for the errors, when I moved to the straight rollup implementation it appears that errors no longer trip up the 'gulp stream' (since there isn't one anymore) so hot/live reload works as expected:
Compile errors are displayed in console but no re-bundling occurs
When the errors are fixed, re-bundling automatically occurs and the UI is updated.
Thanks again for the quick response and support!
(p.s. we are using es6 with gulp which relies on 'es2015' preset in the .babelrc file. To workaround it, I updated our rollup options to be:
I'm strongly for onerror hook too. I think to use eslint plugin which i will configure to throw on style errors/warnings, so i want to see more clearly the output of the ESLint, not that the plugin is failed.
error: 'foo' is assigned a value but never used (no-unused-vars) at src/index.js:3:7:
1 | import add from './add.js'
2 |
> 3 | const foo = 123
| ^
4 | console.log(add({ a: 1, b: 2, c: 123 }))
5 |
1 error found.
[!] (eslint plugin) Error: Errors were found
src/index.js
Error: Errors were found
at error (/home/charlike/github/wooh/node_modules/rollup/dist/rollup.js:185:14)
at Object.error (/home/charlike/github/wooh/node_modules/rollup/dist/rollup.js:9141:6)
at promise.then.previous (/home/charlike/github/wooh/node_modules/rollup/dist/rollup.js:9150:32)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:611:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3
error Command failed with exit code 1.
ERROR: "build:node" exited with 1
Activity
TrySound commentedon Mar 28, 2016
@nkoterba You should use rollup-plugin-babel to process a lot of cases which rollup does not support (es7 or jsx for example). Also you don't need to use any gulp wrappers. Use rollup directly like here https://github.com/TrySound/case/blob/master/gulpfile.js#L22-L46
TrySound commentedon Mar 28, 2016
@nkoterba About gulp3.*. You should catch every "error ready" pipe. And you need just pass native callback to error listener. The last pipe will be always catched. The problem is that errors do not bubble in the pipe. It was fixed in gulp4 which is not released yet, but I still use it.
nkoterba commentedon Mar 28, 2016
@TrySound Thanks for the info. I re-did our build system to use straight rollup, babel, etc. as you suggested. Thanks for the clear/clean code example. We were piping our original gulp output to two destinations but a second gulp task allows us the same functionality.
As for the errors, when I moved to the straight rollup implementation it appears that errors no longer trip up the 'gulp stream' (since there isn't one anymore) so hot/live reload works as expected:
Thanks again for the quick response and support!
(p.s. we are using es6 with gulp which relies on 'es2015' preset in the
.babelrcfile. To workaround it, I updated our rollup options to be:)
tunnckoCore commentedon Sep 13, 2017
I'm strongly for
onerrorhook too. I think to useeslintplugin which i will configure to throw on style errors/warnings, so i want to see more clearly the output of the ESLint, not that the plugin is failed.