c8r/kit

brace import fails static builds

shawnbot opened this issue · 1 comments

Static builds have started failing for a project I'm working on since we upgraded to v5 with the following error:

ReferenceError: window is not defined
    at eval (webpack:///./node_modules/brace/index.js?:20265:21)

We're not using LiveEditor (yet!), but I suspect that somewhere it's being imported that webpack can't tree-shake it, and brace doesn't like being imported outside of the browser. I don't know if Kit supports code-splitting via dynamic import(), but that might be a way to get around this.

Thanks! Yeah, I think this was introduced with the Fetch component in #166 – I think the best solution is to find an editor component that works universally