message: Better error message when custom webpack fails
diff: @@ -46,7 +46,8 @@ pub fn run_build(target: &Target) -> Result<(), failure::Error> {
  let wranglerjs_output: WranglerjsOutput =
  serde_json::from_str(&output).expect("could not parse wranglerjs output");
  - write_wranglerjs_output(&bundle, &wranglerjs_output)
  + let custom_webpack = target.webpack_config.is_some();
  + write_wranglerjs_output(&bundle, &wranglerjs_output, custom_webpack)
  } else {
  failure::bail!("failed to execute `{:?}`: exited with {}", command, status)
  }
  @@ -57,6 +58,7 @@ pub fn run_build_and_watch(target: &Target, tx: Option<Sender<()>>) -> Result<()
  command.arg("--watch=1");
  let is_site = target.site.clone();
  + let custom_webpack = target.webpack_config.is_some();
  log::info!("Running {:?} in watch mode", command);
  @@ -100,7 +102,8 @@ pub fn run_build_and_watch(target: &Target, tx: Option<Sender<()>>) -> Result<()
  let wranglerjs_output: WranglerjsOutput =
  serde_json::from_str(&output).expect("could not parse wranglerjs output");
  - if write_wranglerjs_output(&bundle, &wranglerjs_output).is_ok() {
  + if write_wranglerjs_output(&bundle, &wranglerjs_output, custom_webpack).is_ok()
  + {
  if let Some(tx) = tx.clone() {
  tx.send(()).expect("--watch change message failed to send");
  }
  @@ -117,12 +120,19 @@ pub fn run_build_and_watch(target: &Target, tx: Option<Sender<()>>) -> Result<()
  fn write_wranglerjs_output(
  bundle: &Bundle,
  output: &WranglerjsOutput,
  + custom_webpack: bool,
  ) -> Result<(), failure::Error> {
  if output.has_errors() {
  message::user_error(output.get_errors().as_str());
  + if custom_webpack {
  failure::bail!(
  - "webpack returned an error. You may be able to resolve this issue by running npm install."
  + "Webpack returned an error. Try configuring `entry` in your webpack config relative to the current working directory, or setting `context = __dirname` in your webpack config."
  );
  + } else {
  + failure::bail!(
  + "Webpack returned an error. You may be able to resolve this issue by running npm install."
  + );
  + }
  }
  bundle.write(output)?;
  