Open bershanskiy opened 3 years ago
Expected
Stuff gets built automatically or prints out instructive message, like this:
HINT! Type the following command: yarn build:ssr
https://docs.npmjs.com/cli/v6/using-npm/scripts#pre--post-scripts
FWIW
There is no prebuild
lifecycle script. Also (after filing this issue), I already found a solution ( #2416 ). That solution is consistent with other scripts in package.json
and does everything automatically without interrupting the user.
It's low priority, as you hinted at, but I like the idea of addressing it a bit because it sure is confusing as an error.
But if you check out the code, from a fresh clone, and jump straight into yarn build
the hint in the error shouldn't say that you should run yarn build:ssr
. Instead, it should say yarn prepare-build
.
Do you think you can make a PR for that?
The reason they yarn build:client
and yarn build:ssr
is separated is complicated, but it's reasonable.
When you run yarn dev
and use the http://localhost:5000
server, it will build according to the ssr/dist/main*.js
which might be out of date. During yarn dev
, if you edit a file like client/src/**/*.tsx
it will reload. But if you edit ssr/render.js
for example, it won't re-run the webpack
command to generate a new ssr/dist/*.js
file :(
So, yarn dev
should include a webpack --watch ...
command that's included in the Procfile
. Do you think you can take a look at that too?
@bershanskiy Friendly ping in case you missed the question at the end.
Two tasks:
if you check out the code, from a fresh clone, and jump straight into yarn build the hint in the error (...) should say
yarn build:prepare
.
So, yarn dev should include a
webpack --watch
... command that's included in the Procfile [and buildsssr/dist/*.js
].
When
ssr/dist/
is missing,yarn build
fails with a not very helpful error message.We should update
package.json
script forbuild
to check for existence ofssr/dist
likestart
does.In practice, probably very few people are hitting this error, since README instructs them to run
yarn dev
right after checkout, which generatesssr/dist/
.Repro steps
Do quickstart, but instead of
yarn dev
runyarn build
.Or, if you have a working checkout, just delete
ssr/dist/
and runyarn build
.Error
User gets a bunch of unhelpful text, including complete require stack, etc. The most helpful line is this:
This does not explain how user can generate this module.
Expected
Stuff gets built automatically or prints out instructive message, like this:
P.S.: Yes, for consistency I shamelessly stole the format of the hint from filechecker.