-
Notifications
You must be signed in to change notification settings - Fork 125
Pitching loaders and more complete loader support #15
Conversation
This is totally broken right now, but the compiler delegate is functional
- this.request - this.context - this.resourceQuery - this.loaderIndex
@trueter can you test this out against your SASS codebase? I've made a small example under var path = require('path');
var HappyPack = require('../../');
module.exports = {
entry: path.resolve(__dirname, 'lib/index.scss'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
plugins: [
new HappyPack({
loaders: [ 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap&' ],
cache: false,
threads: 2
})
],
module: {
loaders: [
{
test: /\.scss$/,
loader: path.resolve(__dirname, '../../loader')
}
]
}
}; |
Also, pinging @XVincentX and @texttechne to test if possible. I have not tried the ExtractTextPlugin yet, but the Thanks. |
I'll be happy to try out this and let you know the results. Stay tuned. |
I have tried this branch with
|
@Strate can you share your webpack config? I'm not sure about |
@amireh you know, same thing happens even if I put |
Current coverage is
|
@Strate i did get However, |
@amireh Tried fresh vesrion of this branch, git same error. I'll dig into that. |
Unfortunately I have not been able to look into. I promise I will. |
While I can not provide you example repo, I produced some debugging by add
As you see, there is a lot of |
Since we were identifying loaders merely by the plugin ID, having multiple loader instances run concurrently could overwrite each other as RPC targets. Now, each loader *instance* is identified by the plugin id and the resource it is handling. If this seems to still cause conflicts in the future, we can just resort to using UUIDs.
@Strate I was able to reproduce that case, although unreliably. However, the last patch should fix it in that the happy loader instances will not overwrite each other as targets for an RPC. My guess is that this happens when webpack attempts to compile multiple files in parallel (probably using Let me know if that fixes it. |
@amireh I'll try it on weekend, thank you a lot, man! |
@amireh Everything is ok with tslint-loader, thank you a lot man! Tested on 8 threads. |
I have tried happypacked tslint-loader together with watch mode, and there is an issue while file change triggered:
Seems that you need to test watch mode also. |
And there is another thing: usgin tslint laoder with cache enabled does not produce any warning and error if cache used. Seems that all calls to |
This patch makes the async/sync stages more similar as they now both utilize HappyWorker which does the actual compilation. This should avoid surprises between the watch and single run modes. Also modified the examples to be run with cache and without cache, and they diff their output against webpack without happypack.
Loader dependencies needed for downstream examples are no longer tracked in the main package.json and one spec was referencing babel-loader which is no longer there.
@Strate watch mode should be functional in the last patch, but the caching of loaders like tslint is gonna take more work so I'll leave it for the future. |
@amireh I have updated happypack to #57a27045ea5c25fd65e6234a1c2350df8ddf8694 and it is still fails:
|
Foreground worker is now set up properly with an instance of HappyFakeCompiler instead of webpack's compiler.
the "teardown" routine is now idempotent, got rid of much of the book-keeping state needed between initial/successive builds
This patch brings support for the following loader APIs and context variables:
Variables
this.request
this.context
this.resourceQuery
this.loaderIndex
this.values
injects intothis.inputValues
for succeeding loadersLoader APIs
this.resolve
(the asynchronous version) for resolving modulesthis.emitWarning
this.emitError
this.addDependency
this.addContextDependency
this.clearDependencies
Pitching
module.exports.pitch
applicationthis.data
gets passed from the pitch phase to the normal phaseremainingRequest
andprecedingRequest
inputs to the pitch loadersresourcePath
and other contextual attributes