microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.95k stars 599 forks source link

[heft] The "heft start" command appears to hang when webpack.config.js is missing #2477

Open octogonz opened 3 years ago

octogonz commented 3 years ago

Summary

To understand this problem, try these repro steps:

Repro steps

  1. Create a new Webpack application project, let's say by copying the heft-webpack-basic-tutorial sample project
  2. But let's say that your webpack.config.js file got mispelled accidentally as wepack.config.js (as actually happened today!)

Expected result:

When I run heft start, some kind of error should occur.

Actual result:

When I run heft start, Heft displays this output:

Project build folder is "C:\Git\rushstack\tutorials\heft-webpack-basic-tutorial"
Starting start
 ---- Pre-compile started ----
 ---- Pre-compile ready to continue (30ms) ----
 ---- Compile started ----
[copy-static-assets] Copied 1 file and linked 0 files in 31ms
[typescript] Using TypeScript version 3.9.7
[typescript] Starting compilation in watch mode...
[typescript] Found 0 errors. Watching for file changes.
 ---- Compile ready to continue (2412ms) ----
 ---- Bundle started ----
 ---- Bundle ready to continue (1ms) ----
 ---- Post-build started ----
 ---- Post-build ready to continue (0ms) ----

...and then it just sits there doing nothing. We don't see the usual localhost URL. Webpack doesn't seem to be running at all. Is it stuck? There is no error message, so it's rather confusing how to troubleshoot this mistake (if you didn't realize that your filename was misspelled).

Details

Without a Webpack configuration, heft start behaves essentially like heft build --watch. You could argue that it is a useful behavior. But it is highly confusing for users.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@rushstack/heft version? 0.24.1
Operating system? Windows / Mac
Would you consider contributing a PR? Yes / No
Node.js version (node -v)? 14.15.4

CC @akashkpuri

iclanton commented 3 years ago

Without a Webpack configuration, heft start behaves essentially like heft build --watch.

This is by design. The thought was that "start" for a non-web project is to run the TS compiler in watch mode.

You think we should print an error if someone tries to run heft start for a project that doesn't appear (to heft) to be a web project?

dmichon-msft commented 3 years ago

Possibly the answer here is to ensure that the last line of the output reflects that it is watching for changes and running whatever task?

jbmusso commented 2 years ago

We just started using rush and heft, thanks for the great tools!

The difference between heft start and heft build --watch for a Node.js project wasn't immediately obvious to us but we came to the conclusion that there was no difference, or so it seems? Google'ing for this behavior drove us to this issue.

If we understood correctly, perhaps this behavior should be highlighted in the documentation and/or shown in the console when running the command. Cheers.