preact-cli
preact-cli copied to clipboard
Build fails due to "document" reference in component when preloading
Do you want to request a feature or report a bug? Bug Report
What is the current behaviour?
Not possible to do a successful preact build when using preact-async-route for code splitting due to:
× ERROR ReferenceError: document is not defined
If the current behaviour is a bug, please provide the steps to reproduce.
TL;DR sample repo
- Create a new application through CLI
- Pick typescript (I am not 100% sure this is relevant in some way?)
- Install
preact-async-route - Update at least 1 route to use
Routefrom async-route package and use thegetComponentprop - Run
preact build
What is the expected behaviour? The build to complete successfully and produce all of the expected files
Please mention other relevant information.
Please paste the results of preact info here.
Environment Info:
System:
OS: Windows 10 10.0.19041
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 10.14.1 - E:\nodejs\node.EXE
Yarn: 1.17.3 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.11.3 - E:\nodejs\npm.CMD
Browsers:
Edge: 44.19041.1.0
npmPackages:
preact: ^10.3.1 => 10.3.4
preact-cli: ^3.0.0-next.19 => 3.0.0-rc.10
preact-render-to-string: ^5.1.4 => 5.1.4
preact-router: ^3.2.1 => 3.2.1
https://github.com/prateekbh/preact-async-route#deprecation-notice
preact-async-route is not supported for preact X. Use Suspense/Lazy instead