Closed DeanPDX closed 3 years ago
Ah, good catch! I'd say check !env.isProd
, personally.
Right now there is no way to run preact-cli in dev without the dev server, though that has been requested and there have been a few attempts at fulfilling it. Leaving that possibility open without the wiki requiring future edits would be nice.
config
is the webpack config itself, and I'd probably suggest straying away from reading that for conditionals when env
covers your needs.
Definitely worth updating if you want to do it. It's a GitHub wiki, so no PRs needed. You can just edit the document
Definitely worth updating if you want to do it. It's a GitHub wiki, so no PRs needed. You can just edit the document
Done. I included a comment to try to explain why we are checking environment as well. Thanks for getting back to me so quickly.
Awesome, thanks for adding!
Good call on the extra comment
What is the current behaviour? When you try to create a production build, you get the following error:
Steps to Reproduce
npm run build
.What is the expected behaviour? I would expect the config recipe to not break my production build.
Fixing my production build To fix my build, I checked for the existence of the devServer before attempting to set the proxy config:
I thought about checking
env.dev
instead. However, I wasn't sure if:Proposed solution Is it worth updating the docs? I would be happy to submit a pull request if so. And is it more correct to check for
env.dev
or just the existence ofconfig.devServer
?