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

Error when starting with less-loader and ExtractTextPlugin #66

Closed
Tom910 opened this issue Aug 2, 2016 · 9 comments
Closed

Error when starting with less-loader and ExtractTextPlugin #66

Tom910 opened this issue Aug 2, 2016 · 9 comments

Comments

@Tom910
Copy link
Contributor

Tom910 commented Aug 2, 2016

I'm using the settings that are written in @amireh #14 and get an error

TypeError: loaderContext.loadModule is not a function
at /node_modules/less-loader/index.js:117:18
at HappyFakeCompiler.HFCPt._handleResponse (/node_modules/happypack/lib/HappyFakeCompiler.js:58:3)

[email protected], [email protected], [email protected], [email protected]

If I use Webpack 2, I get a completely different problem

/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:30
throw new Error("Signature changed: context parameter added");
^

Error: Signature changed: context parameter added
at Tapable.resolve (/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:30:9)
at Object.HappyRPCHandler.execute (/node_modules/happypack/lib/HappyRPCHandler.js:25:37)
at ChildProcess.acceptMessageFromWorker (/node_modules/happypack/lib/HappyThread.js:49:27)
at emitTwo (events.js:111:20)
at ChildProcess.emit (events.js:191:7)
at process.nextTick (internal/child_process.js:719:12)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

[email protected], [email protected], [email protected], [email protected]/[email protected]

@todd-richmond
Copy link

I had similar problems and had to disable happypack for loader chains in release builds where I was using the extract text plugin. Dev builds were fine because they didn't extract. This code assumes you are using the "id" based happy feature

''
const happypack = require('happypack');
const happyThreadPool = happypack.ThreadPool({size: 4});

config.module.loaders.forEach((loader) => {
    // happypack does not work w/ extract-text
    if (loader.happy && (loader.loader + loader.loaders).indexOf(
        'extract-text-webpack-plugin') === -1) {
        config.plugins.push(new happypack({
            id: loader.happy.id,
            threadPool: happyThreadPool
        }));
    }
});

@amireh
Copy link
Owner

amireh commented Aug 6, 2016

TypeError: loaderContext.loadModule is not a function means that loader is using an API that HappyPack doesn't support. The webpack 2 error regarding signature changing is a happypack bug that should be fixed.

If you guys can set up a small test repo that reproduces this I can take a look.

@Tom910
Copy link
Contributor Author

Tom910 commented Aug 6, 2016

Yes, my case works now. PR Added a new example #69

@amireh
Copy link
Owner

amireh commented Aug 6, 2016

Can we close this then?

@Tom910 Tom910 closed this as completed Aug 6, 2016
@Tom910 Tom910 reopened this Aug 8, 2016
@Tom910
Copy link
Contributor Author

Tom910 commented Aug 8, 2016

@amireh I have reproduced the bug, with the less there is a problem when we do @import. An example of an error is here - https://github.com/Tom910/happypack /examples/webpack2-extract-react

resolve { context: '/assets/styles/conf', resource: '../variables/variables.less' }

resolve /assets/styles/conf ../variables/variables.less function (error, result) {
// console.log('forwarding compiler response from plugin back to worker:', error, result);

        fd.send({
          name: 'COMPILER_RESPONSE',
          data: {
            id: message.data.id,
            payload: {
              error: error || null,
              result: result || null
            }
          }
        });
      } undefined

/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:31
throw new Error("Signature changed: context parameter added");
^

Error: Signature changed: context parameter added
at Tapable.resolve (/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:31:9)
at Object.HappyRPCHandler.execute (/node_modules/happypack/lib/HappyRPCHandler.js:25:37)
at ChildProcess.acceptMessageFromWorker (/node_modules/happypack/lib/HappyThread.js:54:27)
at emitTwo (events.js:111:20)
at ChildProcess.emit (events.js:191:7)
at process.nextTick (internal/child_process.js:719:12)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

@amireh
Copy link
Owner

amireh commented Aug 8, 2016

Thank you, will take a look

amireh added a commit that referenced this issue Aug 8, 2016
@amireh
Copy link
Owner

amireh commented Aug 8, 2016

This should be functional now on master (in both webpack 1 and 2). Please try it and confirm, it will be available in the next release.

FWIW, the support for that API didn't exist until this patch so it's not really a regression.

@Tom910
Copy link
Contributor Author

Tom910 commented Aug 8, 2016

Yes it is version works to my project
Happy[jsx]: Loaded 3210 entries
Happy[less]: Loaded 434 entries

Thanks

@Tom910 Tom910 closed this as completed Aug 8, 2016
amireh added a commit that referenced this issue Aug 8, 2016
@amireh
Copy link
Owner

amireh commented Aug 8, 2016

Released in v2.2.0.

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

No branches or pull requests

3 participants