Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.

Not work in typescript 2.4 #111

Closed
itfinally opened this issue Nov 24, 2017 · 2 comments
Closed

Not work in typescript 2.4 #111

itfinally opened this issue Nov 24, 2017 · 2 comments

Comments

@itfinally
Copy link

itfinally commented Nov 24, 2017

Hello , in typescript 2.4, worker-loader 1.1.0, it not work.

I following the chapter of "Integrating with TypeScript" to write this file:

// web_worker.d.ts

declare module "worker-loader!*" {
    class WebpackWorker extends Worker {
        constructor();
    }

    export = WebpackWorker;
}
// bootstrap.ts

import Worker from "worker-loader!./src/test.worker";

let worker = new Worker();

Oh, also i have the configuration in the tsconfig.json

"files": [
    "src/web_worker.d.ts"
  ]

But got this exception -> TS1192: Module '"worker-loader!*"' has no default export.
So how can i running this?

@pconerly
Copy link

You need export default WebpackWorker; not export = WebpackWorker;

@michael-ciniawsky
Copy link
Member

@itfinally See @pconerly comment @pconerly Thx 👍 Feel free to reopen if still regressions :)

thallada added a commit to thallada/worker-loader that referenced this issue Apr 22, 2018
Updates the TypeScript example to use the ES6 import syntax like the other examples. Includes the change to `Worker.ts` mentioned in webpack-contrib#111 to get it to work with `import` instead of `require`.
shellscape pushed a commit that referenced this issue May 27, 2018
Updates the TypeScript example to use the ES6 import syntax like the other examples. Includes the change to `Worker.ts` mentioned in #111 to get it to work with `import` instead of `require`.
TheLD6978 pushed a commit to TheLD6978/worker-loader that referenced this issue Apr 16, 2021
Updates the TypeScript example to use the ES6 import syntax like the other examples. Includes the change to `Worker.ts` mentioned in webpack-contrib#111 to get it to work with `import` instead of `require`.
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