Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

RollupCompiler does not output warnings in dev mode #1266

Open
benmccann opened this issue Jun 12, 2020 · 2 comments
Open

RollupCompiler does not output warnings in dev mode #1266

benmccann opened this issue Jun 12, 2020 · 2 comments

Comments

@benmccann
Copy link
Member

benmccann commented Jun 12, 2020

Describe the bug
Sapper doesn't flush Rollup warnings when it receives an error in dev mode

I think these warnings only apply to errors in the rollup.config.js file

To Reproduce
git clone git@github.com:babichjacob/sapper-typescript-graphql-template.git

Pass

{
	files: ["not-exist.ts"],
}

as options to typescript(/* here */). You get the opaque error

@rollup/plugin-typescript: Couldn't process compiler options

Expected behavior

(typescript plugin) @rollup/plugin-typescript TS5023: Unknown compiler option 'files'.

Information about your Sapper Installation:

  • Sapper version 0.27.15
  • dev mode
  • Rollup

Severity
Quite frustrating for users who don't know about this bug. Not so bad for me since I know it exists and can work around it in my rollup config or by running npm run build instead

Additional context
Thanks to @babichjacob for the testing. He discovered it in babichjacob/sapper-typescript-graphql-template#7

#1236 flushed warnings in compile. I didn't realize that dev mode might not call compile. It looks to me like it instead calls a different method watch. We should flush warnings in that case as well. I got most of the last fix from Rollup's cli. Here's what they do: https://github.com/rollup/rollup/blob/08a6255ce0af2dca775e828919f035b433b35fed/cli/run/watch-cli.ts#L93

@benmccann
Copy link
Member Author

benmccann commented Jun 16, 2020

cli.ts listens for events: https://github.com/sveltejs/sapper/blob/master/src/cli.ts#L94

These are custom Sapper events output by dev.ts:

compiler.watch((error?: Error, result?: CompileResult) => {

Which are originally from here:

@benmccann
Copy link
Member Author

Rollup has a step for parsing the config file that would generate the warnings that we seem not to have:

https://github.com/rollup/rollup/blob/08a6255ce0af2dca775e828919f035b433b35fed/cli/run/watch-cli.ts#L58

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
Roadmap Triage
Rollup, Webpack, and alternatives
Development

No branches or pull requests

1 participant