Skip to content
This repository was archived by the owner on Apr 19, 2021. It is now read-only.

🐛 fix: workaround Sapper's warning-swallowing issue until it's solved upstream #4

Merged
merged 1 commit into from
May 30, 2020

Conversation

babichjacob
Copy link
Owner

I've had to deal with sveltejs/sapper#1221 before, and I'll forget about this being the reason if we don't solve it explicitly now. Let's make this the last time gets frustrated with this error (provided they use this template or its derivative).

How's this approach @benmccann? Probably going to merge it in the evening if there aren't any cases it misses.

@benmccann
Copy link
Contributor

I'd add the workaround to rollup.config.js instead. The Rollup warning being swallowed has hit me other places too.

// Workaround for https://github.com/sveltejs/sapper/issues/1221
//const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || console.error(warning.message);

I think adding this message is a little bit duplicative of the Rollup warning. The real problem is that the Rollup warning wasn't appearing. I solved it immediately once I got the warning to come through.

@babichjacob
Copy link
Owner Author

Okay, there.
My goal is to merge this across all 3 templates after (the next set of) comment(s).

@benmccann
Copy link
Contributor

I'm not sure if anything in this PR is really necessary now that sveltejs/sapper#1236 is available. I'd probably just wait for it to be merged instead

The one thing I would change in this repo though is to rename the .js files to .ts. client.js especially since that's an easy one to do

@babichjacob
Copy link
Owner Author

I'm not sure if anything in this PR is really necessary now that sveltejs/sapper#1236 is available. I'd probably just wait for it to be merged instead

How long can we estimate for this to be available? I'm not sure if it's reasonable to change the dependency to reference a fixed commit of the repo (if that's even possible) over the version on NPM.

The one thing I would change in this repo though is to rename the .js files to .ts. client.js especially since that's an easy one to do
Isn't there a PR you made that hasn't been merged yet that's necessary for this?
I think I've correctly converted client.js and server.js to .ts but I'm getting:

✗ server
Could not resolve entry module (src/server.js).
✗ client
Could not resolve entry module (src/client.js).

on 0.27.13

@benmccann
Copy link
Contributor

It's already been merged. I'm not sure when they'll do the next release

You can edit the rollup config to make it take .ts files:

client: input: config.client.input().replace(/\.js$/, '.ts')
server: input: { server: config.server.input().server.replace(/\.js$/, '.ts') }
sw: input: config.serviceworker.input().replace(/\.js$/, '.ts'),

@babichjacob babichjacob changed the title 🐛 fix: safeguard against TypeScript files absent from src erroring @rollup/plugin-typescript, crashing the build 🐛 fix: workaround Sapper's warning-swallowing issue until it's solved upstream May 28, 2020
@babichjacob
Copy link
Owner Author

Great! Because of #6, this PR has been reduced to just the warning workaround.

@babichjacob babichjacob merged commit 8e1a784 into master May 30, 2020
@babichjacob babichjacob deleted the safe-missing-ts branch July 22, 2020 21:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants