Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad error catch #11

Open
ArvoGuo opened this issue Sep 6, 2015 · 7 comments
Open

bad error catch #11

ArvoGuo opened this issue Sep 6, 2015 · 7 comments

Comments

@ArvoGuo
Copy link

ArvoGuo commented Sep 6, 2015

if there is a error of syntax like

return <div className={styles.logo} >;
or
return <div className={styles.logo)} />;

the server just be broken!

@patrikholcak
Copy link

Hey, it looks like you need to install the server require hook.

@alexFaunt
Copy link

I have the same issue as ArvoGuo has suggested, if i run webpack-dev-server, all is okay.

But if introduce a syntax error in a Js file to invalidate the build, the server then crashes instead of recovering gracefully

  • the server require hook you mentioned - how would that help solve this issue?

@patrikholcak
Copy link

Oh, I missed the paren on the second line (as I never used jsx) and automatically assumed it is a require-hook related issue as @ArvoGuo mentions server. Sorry for that to both of you.

Could you please provide your webpack config and a snippet that fails? I’ve been using css modules for a quite a while now and did not encounter this. And believe me when I say I make a lot of typos and syntax errors. However, I’m using coffee-script so this might be babel/jsx related?

@alexFaunt
Copy link

Hi, thanks for looking, was an untouched clone of this repo, so the config is https://github.com/css-modules/webpack-demo/blob/master/webpack.config.js

Heres a gist of the error log: https://gist.github.com/alexFaunt/39dc35adbfc5608fe51d

I'm a bit of a webpack beginner so i'm not sure what i'm looking at. I've been playing around using webpack --watch instead

@patrikholcak
Copy link

So, as I thought, the issue is related to ReactToHtmlPlugin. If you remove it, the server recovers just fine.

What I did:

  • removed the completely useless .ejs template and replaced it with a .html one in the root directory
  • removed ReactToHtmlPlugin from webpack config

webpack-demo/index.html

<html>
  <head>
    <title>CSS Modules Webpack Demo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" type="text/css" href="style.css" />
  </head>
  <body>
    <div id="outlet"></div>
    <script src="/index.js"></script>
  </body>
</html>

This should do it for now. I’ll fork this repo and edit it to be more dev-friendly. I’ll let you know once it’s done.

@alexFaunt
Copy link

Amazing, cheers

@patrikholcak
Copy link

No problem, @alexFaunt.

I forked this repo, removed some unnecessary bits and dependencies and added gaearon's awesome react-hot-loader.

It’s not ready for production for now, but I plan on keeping it up to date. You can check it out here:
https://github.com/patrikholcak/webpack-demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants