Skip to content

When a new file fails to compile it is not watched #74

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

Closed
ethul opened this issue Nov 10, 2016 · 20 comments
Closed

When a new file fails to compile it is not watched #74

ethul opened this issue Nov 10, 2016 · 20 comments
Assignees

Comments

@ethul
Copy link
Owner

ethul commented Nov 10, 2016

No description provided.

@ethul ethul self-assigned this Nov 20, 2016
@forestbelton
Copy link

Hey @ethul, are you actively working on this? If not, I'd like to give it a shot. This is a pretty big pain point for me while developing PureScript applications that have a heavy JavaScript integration.

@ethul
Copy link
Owner Author

ethul commented Dec 17, 2016 via email

@ethul
Copy link
Owner Author

ethul commented Dec 17, 2016

@forestbelton I was just thinking that it might work to omit passing an error to the webpack callback upon failure. This may keep the file in the watch. So we would make the following a no-op:

reject: error => callback(error),

I haven't tried this, but this is how the load works when psc-ide is used. Might be worth a try.

@ethul
Copy link
Owner Author

ethul commented Dec 17, 2016

Or not a no-op, but just pass back the previous JS to the callback.

@tbenst
Copy link

tbenst commented Feb 15, 2017

Here's a possible solution: https://github.com/shama/webpack-stream/pull/126/files

@ethul
Copy link
Owner Author

ethul commented Feb 15, 2017

Thanks for the tip. I was testing out something like this over the weekend. Might very well be the way to go.

@tbenst
Copy link

tbenst commented Feb 15, 2017

I did an attempt here: tbenst@b8aaa2f

But I haven't been able to test as I can't seem to get purs-loader installed via github. I imagine I'm missing a compilation step in building the package.

@ethul
Copy link
Owner Author

ethul commented Feb 16, 2017

Thanks! I think something along these lines might work. I will take a look this weekend and try out some ideas.

ethul added a commit that referenced this issue Feb 19, 2017
Similar to the way psc-ide support works, the purs-loader now tolerates
compiler errors when the `watch` option is true. When webpack is being
run in watch mode the user can set `watch` to true in order to avoid
failing the webpack bundle creation when the PureScript compiler fails.

Resolves issue #66

Resolves issue #73

Resolves issue #74
@ethul
Copy link
Owner Author

ethul commented Feb 20, 2017

I've published a beta release that should fix this issue. If anyone is willing to give it a try, that would be great! You can install the release under the beta dist tag.

npm install purs-loader@beta

In this release, there is a new option called watch. Please set this to true in your webpack config if you are running webpack in watch mode.

Thanks!

@dikmax
Copy link

dikmax commented Feb 20, 2017

In https://github.com/ethul/purs-loader/blob/topic/error-handling/src/to-javascript.js
there's a typo which prevents anything to be built.

psMoudle -> psModule.

Line 45

@ethul
Copy link
Owner Author

ethul commented Feb 20, 2017

Thank you for catching this. I've fixed this in 2.4.0-beta.1.

@dikmax
Copy link

dikmax commented Feb 20, 2017

Works without any issues now. Awesome!

Thank you!!!

@ethul
Copy link
Owner Author

ethul commented Feb 20, 2017

Great! Thank you for confirming

@dikmax
Copy link

dikmax commented Feb 20, 2017

Just noticed, builds stop working if a file is removed.

@ethul
Copy link
Owner Author

ethul commented Feb 20, 2017

If imports to the file removed are also removed, does the build work once again?

@dikmax
Copy link

dikmax commented Feb 21, 2017

Unfortunately, I cannot reliably reproduce this issue, but it has something to do with dependencies. When I find suitable scenario I'll write it.

@tbenst
Copy link

tbenst commented Feb 21, 2017

I'm also having occasional difficulty, it works initially but occasionally stops watching after many minutes. I know that's vague and will report back if I notice a pattern

Edit: seems to stop watching when a ErrorParsingModule or UndefinedTypeVariable ocurrs. Perhaps it doesn't recompile after one is fixed if a second error of the same type (but different line) exists?

@ethul
Copy link
Owner Author

ethul commented Feb 21, 2017

Thanks for following up on this. I will try out the ErrorParsingModule and UndefinedTypeVariable cases.

Thanks!

@ethul
Copy link
Owner Author

ethul commented Feb 25, 2017

I released 2.4.0-beta.2 which adds a check when a module is not in the module mapping. The goal is to handle when files are removed.

I haven't been able to reproduce the watch issue yet. I tried the two errors above, but it seems to be working for me. Maybe we can track this as a new issue if we can get a reproducible case.

@ethul
Copy link
Owner Author

ethul commented Feb 25, 2017

@ethul ethul closed this as completed Feb 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants