Giter Club home page Giter Club logo

Comments (9)

gilamran avatar gilamran commented on June 8, 2024

I wouldn't recommend using tsc-wach along with webpack. tsc-watch was intended for cases where you want to restart something, like your nodejs server or a test suite.

Webpack is able to listen to new files and rebuild using typescript (I'm using awesome-typescript-loader). Using Webpack and an external compiler might cause webpack to refresh several times or even "miss" some changes, as compilation might output several files...

Do you have other reasons to "run-once" after a successful compilation?

from tsc-watch.

amir-arad avatar amir-arad commented on June 8, 2024

generally speaking, chaining hot-reloading services (while avoiding the initial reload after first compilation) is the use case.

specifically, I find webpack's ts loaders lacking in some aspects and would like to manage the build chain myself. benefits are:

  1. transpilation cache in plain FS format, ready for publish
  2. multi-process dev server, taking advantage of more cores for cpu-heavy chores such as transpilation and bundling
  3. simpler tools, less edge-case bugs (for instance, I don't use hard-source-webpack-plugin or happypack)

from tsc-watch.

gilamran avatar gilamran commented on June 8, 2024

In your case (Specific use case), I would recommend using the library an not the command line tool.
This way, you can listen to events, and run your own "custom" code:

const watch = require('tsc-watch/client');
watch.on('first_success', () => {
  watch.kill();
});

WDYT?

from tsc-watch.

amir-arad avatar amir-arad commented on June 8, 2024

that's the way to get it done with the current CLI, sure.
but what about a onFirstSuccessTillExit param?

from tsc-watch.

gilamran avatar gilamran commented on June 8, 2024

I don't think that this is a public need, If we get some +1s on that I will consider it. But as it is possible with the current implementation (Without adding new feature) I'd rather keep it simple for the general public.

You can always fork πŸ˜‰

from tsc-watch.

gilamran avatar gilamran commented on June 8, 2024

Gr8, I see that you forked and implemented it on your own version.

from tsc-watch.

gilamran avatar gilamran commented on June 8, 2024

I'm happy to say that as of version 2.0.0 the onFirstSuccess will not get killed.

from tsc-watch.

iagomelanias avatar iagomelanias commented on June 8, 2024

The version 2.0.0 is not published on NPM. Was it intentional?

from tsc-watch.

gilamran avatar gilamran commented on June 8, 2024

@iagomelanias , you are right.
I just published version 2.1.2 as the latest.

from tsc-watch.

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.