Giter Site home page Giter Site logo

Comments (11)

krskrs avatar krskrs commented on June 18, 2024 1

Hi @rschristian!
Yes, and, putting patching theories aside πŸ˜„, I can tell you that I've been working with the 'patched' version and no more hangs so far, and now I believe I can say for good. So I'll see if I manage to make that pull request for the 3.x branch. I haven't put aside the idea of doing it. And we're talking of tiny and "secure" changes, I'd say.

from preact-cli.

rschristian avatar rschristian commented on June 18, 2024 1

Sorry, meant to do that earlier. It's now up at 3.x.x

from preact-cli.

krskrs avatar krskrs commented on June 18, 2024

I can also add that the before updating, I was using preact-cli 3.3.4 and had never experienced such issue. Then I went from 3.3.4 directly to 3.5.0 and the problem started.

from preact-cli.

rschristian avatar rschristian commented on June 18, 2024

You can try enabling verbose Webpack stats, I don't believe CLI's --verbose flag sets that.

I can also add that the before updating, I was using preact-cli 3.3.4 and had never experienced such issue. Then I went from 3.3.4 directly to 3.5.0 and the problem started.

You can try to git bisect to find the troublesome commit (& preferably the troublesome change itself), but if you're struggling to reliably reproduce it, that may take a while.

Keep in mind Preact-CLI is unmaintained -- I'd recommend bumping up to v4 and then move onto Vite via create-preact when possible.

from preact-cli.

krskrs avatar krskrs commented on June 18, 2024

Hi @rschristian and thanks for the quick response!
So, I couldn't use stats, because when the issue occurs, compiler.run() won't return and so I haven't access to the stats object.
Then I looked a bit into the code and managed to hack this directly into webpack-base-config.js (I suppose it could have been done from preact config file, but this was quicker for me, just for debugging)

image

This allowed to determine where the build is exactly hanging:

image

			...(tsconfig
				? [
						new ForkTsCheckerWebpackPlugin({
							checkSyntacticErrors: true,
							async: !isProd,
							tsconfig: tsconfig,
							silent: !isWatch,
						}),

and the funny thing is that this dependency stayed exactly the same between cli 3.3.4 (where build never got stuck) and 3.5.0. So it must be some other thing which got updated and started to interfere with it, maybe ts itself, who knows.

I would like to switch to Vite, but this is a production project, quite big, and at this time we haven't the resources for planning such a big switch.

So at present, we can either further dig into the issue, or try Preact-CLI v4, but is it still being developed? Or is the entire project unmaintained?

from preact-cli.

rschristian avatar rschristian commented on June 18, 2024

So, I couldn't use stats, because when the issue occurs, compiler.run() won't return and so I haven't access to the stats object.

Odd, never seen that before.

the funny thing is that this dependency stayed exactly the same between cli 3.3.4 (where build never got stuck) and 3.5.0.

That dep might not have changed, but #1798 would probably have an effect. Worth checking. Might be worth checking if it's outputting anything too:

new ForkTsCheckerWebpackPlugin({
	checkSyntacticErrors: true,
	async: !isProd,
	tsconfig: tsconfig,
-	silent: !isWatch,
+	silent: false,
}),

Narrowing down the version range would also help, there's 8 versions between 3.3.4 and 3.5.0.

So at present, we can either further dig into the issue, or try Preact-CLI v4, but is it still being developed? Or is the entire project unmaintained?

It's a loose "unmaintained" -- I may pop in to fix some things that I need, and I'll (eventually) have time to review fixes if someone in the community wants to submit some, but I'm not going to be developing it any further.

from preact-cli.

krskrs avatar krskrs commented on June 18, 2024

I wanted to follow up on this. After investigating quite a bit, I found out that the 4.x version of ForkTsCheckerWebPack plugin, which 3.5 version is depending on, seems to have some race/odd issues with the latest 4.9.x typescript versions. In fact all started after updating preact-cli to 3.5 and, as a consequence of #1798 , having ts updated to the latest version of the 4.9 branch.

In the end I managed to find a good compromise to make everything work (upgrading ForkTsChecker to the 6.x branch and 2 tiny patches on preact-cli regarding the new fts configuration format, and disabling it for the babel-esm plugin which triggers another apply on all plugins).

Now, I know that the 4.x version has newer dependencies but, since it also has some potentially breaking changes (or that's what I assumed after reading some information here here in the repo), in case somebody with big code bases want/need to stick with the 3.x branch for a while longer, I can submit a PR, if you think it might be useful

Thanks again for the support!

from preact-cli.

rschristian avatar rschristian commented on June 18, 2024

In fact all started after updating preact-cli to 3.5 and, as a consequence of #1798 , having ts updated to the latest version of the 4.9 branch.

That is not what #1798 did, no. It did the opposite of that in fact, it removed TS altogether.

Because we shipped a version of TS w/ CLI, the issue was that, with Node's module resolution, dependencies of CLI (like fork-ts-checker) would (usually) prefer other CLI dependencies, such as TS. This was an issue as it made it quite difficult to use different versions of TS w/ Preact-CLI.

By removing the dependency, users are expected to provide their own version if they need it. This should be pretty clear in the release notes.

In the end I managed to find a good compromise to make everything work (upgrading ForkTsChecker to the 6.x branch and 2 tiny patches on preact-cli regarding the new fts configuration format, and disabling it for the babel-esm plugin which triggers another apply on all plugins).

A better solution might be to downgrade your project's TS version to what was previously in use, rather than patching CLI.

I can submit a PR, if you think it might be useful

If you'd like, though IIRC, newer versions caused other issues. If the test suite passes I'd be happy to merge though.

from preact-cli.

krskrs avatar krskrs commented on June 18, 2024

In fact all started after updating preact-cli to 3.5 and, as a consequence of #1798 , having ts updated to the latest version of the 4.9 branch.

That is not what #1798 did, no. It did the opposite of that in fact, it removed TS altogether.

Because we shipped a version of TS w/ CLI, the issue was that, with Node's module resolution, dependencies of CLI (like fork-ts-checker) would (usually) prefer other CLI dependencies, such as TS. This was an issue as it made it quite difficult to use different versions of TS w/ Preact-CLI.

By removing the dependency, users are expected to provide their own version if they need it. This should be pretty clear in the release notes.

yes, my bad, I haven't been clear, and indeed the description and the aim of your change is clear. What I meant was something like an indirect consequence of the change: passing from a "real" dependency to a peer dependency, made npm install "touch" the ts in my installation, removing CLI's own ts version and at the same time taking the chance to update my root ts installation, which ended up to v4.9.5, satisfying both your now peer dependency ("typescript": "^4.6.4") and my main dependency in package.json ("typescript": "^4.5.2")

In the end I managed to find a good compromise to make everything work (upgrading ForkTsChecker to the 6.x branch and 2 tiny patches on preact-cli regarding the new fts configuration format, and disabling it for the babel-esm plugin which triggers another apply on all plugins).

A better solution might be to downgrade your project's TS version to what was previously in use, rather than patching CLI.

yes, I totally agree that patching a package is 100% bad practice, even more if patched by hand as I did (but I was just hacking out, I almost debugged all forkTsChecker πŸ˜„ in the process). That's one of the reasons I was also proposing the PR, the other being that I believe what happened to me could happen to others.

I can submit a PR, if you think it might be useful

If you'd like, though IIRC, newer versions caused other issues. If the test suite passes I'd be happy to merge though.

from preact-cli.

rschristian avatar rschristian commented on June 18, 2024

(Sorry, missed this)

I totally agree that patching a package is 100% bad practice

I don't actually think that, I patch like a mad man sometimes to be honest! A-ok to do so in my book.

There's just not a ton of new TS constructs since, so I was assuming it'd be easier to downgrade TS than maintain a patch, but I see nothing wrong with it either way -- just a guess as to what might be easier.

from preact-cli.

krskrs avatar krskrs commented on June 18, 2024

ook, here we go: https://github.com/krskrs/preact-cli/tree/3.x but now I'm not sure on how we should proceed. I created a new branch (3.x) b/c I couldn't patch master where you've the 4.x development ongoing.
Maybe you could create the same branch on your repo so that I can create a pull request there? (apologize if I wrote some nonsense but I'm not very expert on github mechanics).

from preact-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.