andywer / threads-plugin

📦 Makes your threads.js code build with webpack out of the box.
Apache License 2.0
28 stars 6 forks source link

Trouble with @babel/types #46

Closed rogue-ninja-creative closed 3 years ago

rogue-ninja-creative commented 3 years ago

When I install this plugin, I'm told I'm missing the peer dependency @bable/types, but when I install @babel/types, my vue single-file components no longer compile. I don't use TypeScript in my project.

I'm not too familiar with @bable/types. Any ideas to help me troubleshoot?

EDIT - This was actually due to having another new Worker() somewhere in my code to manually load a worker. But now that I've removed it I'm getting "Did not receive an init message from worker"

const pool = Pool(() => spawn(new Worker('@workers/tcr-worker', { type: 'module' })), 8)
const myTasks = []

for (let i = 0; i < 8; i++) {
  let payload = {
    attendanceRecords: chunkified[i],
    employees: this.employees,
  }

  const task = pool.queue(tcr => {
    return tcr.employeeListBuilder(payload)
  })
  myTasks.push(task)
}

EDIT - I had the following rule in my webpack config that was picking up the web workers before the threads-plugin.

{
  test: /\-worker\.js$/,
  use: { loader: 'worker-loader' }
}

Removing this fixed the issue.

Apologies for the unnecessary issue.