Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Added ts-loader example #167

Merged
merged 1 commit into from
Jun 2, 2017
Merged

Added ts-loader example #167

merged 1 commit into from
Jun 2, 2017

Conversation

johnnyreilly
Copy link
Contributor

This should resolve #164

I'm afraid I can't run the test as I'm on Windows. I've done my best to guess how it should work - may need your help there if it doesn't run. Fingers crossed!

@codecov-io
Copy link

codecov-io commented Jun 1, 2017

Codecov Report

Merging #167 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #167   +/-   ##
=======================================
  Coverage   94.66%   94.66%           
=======================================
  Files          22       22           
  Lines         656      656           
=======================================
  Hits          621      621           
  Misses         35       35

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01b01d6...3bb9bba. Read the comment docs.

@amireh
Copy link
Owner

amireh commented Jun 1, 2017

So responsive! Haha, thank you, I'll try it out as soon as I can.

@amireh
Copy link
Owner

amireh commented Jun 1, 2017

Hmm, I'm seeing something strange where the fork-ts-checker plugin isn't despawning its services. Is this intended? The example fails to run because the process is never killed. Here's a snippet that shows the remaining (zombie) processes:

user:happypack$ ps -ef | grep ts-loader
user   18577     1 42 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18583     1 44 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18584     1 41 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18586     1 41 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18591     1 43 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18602     1 43 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18603     1 43 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18614     1 39 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18620     1 43 01:04 pts/19   00:00:00 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js
user   18626     1 78 01:04 pts/19   00:00:01 ~/.nvm/versions/node/v6.3.1/bin/node --max-old-space-size=2048 ~/Workspace/Projects/happypack/examples/ts-loader--webpack2/node_modules/fork-ts-checker-webpack-plugin/lib/service.js

I have to manually kill them to get this to clean up.

@johnnyreilly
Copy link
Contributor Author

@pietr-oles can you comment on this please?

@johnnyreilly
Copy link
Contributor Author

Let's try that again 😄 @piotr-oles would you be able to comment on this please? It sounds like there might be an issue with fork-ts-checker plugin despawning its services...

@dziamid
Copy link

dziamid commented Jun 2, 2017

This works great except with dll plugin. It builds the dll file, but the process does not exit.


Building the Webpack DLL...
Loaded environment variables for development:
{ BASE_API: '//api.dev2.noviopus.com/api', PORT: '3000' }
version 1.7.2
Happy[ts]: Version: 4.0.0-beta.1. Threads: 4
Happy[ts]: All set; signaling webpack to proceed.
Starting type checking service...
Using 2 workers with 2048MB memory limit
/home/dziamid/dev/noviopus/tsconfig.json


No type errors found
Version: typescript 2.3.3
Time: 28720ms
chunk    {0} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 12.8 MB [entry] [rendered] 
//hangs here

@johnnyreilly
Copy link
Contributor Author

Thanks @dziamid - that's good to know. Hopefully @piotr-oles can advise. I may open an issue on fork checker to track.

@piotr-oles
Copy link

I'm working on it, will let you know :)

@piotr-oles
Copy link

The problem with fork-ts-checker-webpack-plugin was misleading configuration. I've released v0.2.0 with some improvements you can check in changelog.

The main change is removing blockEmit option and setting it automatically (false for 'watch' mode, true for 'one build' mode). Also, it doesn't start chokidar watcher on build mode (the process didn't want to exit because of files watcher).

@amireh
Copy link
Owner

amireh commented Jun 2, 2017

I have verified that it works once we upgrade to 0.2.0 - merging this! Thanks all.

@amireh amireh merged commit 9d258be into amireh:master Jun 2, 2017
@amireh
Copy link
Owner

amireh commented Jun 2, 2017

The README now indicates TypeScript compatibility - thank you all for your work.

@johnnyreilly
Copy link
Contributor Author

I've simplified the example in the PR and removed api bits that are no longer part of fork-ts-checker. Hope that helps!

"author": "John Reilly <[email protected]> ",
"license": "ISC",
"devDependencies": {
"fork-ts-checker-webpack-plugin": "^0.1.2",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, change it to ^2.0.0 :)

},
plugins: [
new ForkTsCheckerWebpackPlugin({
tslint: false, // disable tslint support

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unnecessary now - it's disabled by default

tslint: false, // disable tslint support
watch: './src', // optional but improves performance (less stat calls)
workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE, // use multi-process mode, leave 2 cpu's free for builder and system
blockEmit: process.env.NODE_ENV === 'production' // for production make it synchronous

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, remove this - this is no longer useful - it's computed automatically

entry: './src/index.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].raw.js'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be:

        path: path.resolve(__dirname, 'dist--raw'),
        filename: '[name].js'

:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh you might be right!

watch: './src', // optional but improves performance (less stat calls)
workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE, // use multi-process mode, leave 2 cpu's free for builder and system
blockEmit: process.env.NODE_ENV === 'production' // for production make it synchronous
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above - tslint and blockEmit is no longer needed :)

@piotr-oles
Copy link

I've forgot to submit revew yesterday, it was pending. Never mind, it's not up to date :)

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

Successfully merging this pull request may close these issues.

using ts-loader with happypack
5 participants