andywer / webpack-blocks

šŸ“¦ Configure webpack using functional feature blocks.
MIT License
2.97k stars 94 forks source link

Update typescript block to work with webpack 4 #296

Closed s-h-a-d-o-w closed 1 month ago

s-h-a-d-o-w commented 6 years ago

I'm using webpack-blocks to provide configuration to react-styleguidist and experienced the following errors.

TypeError: resolver.ensureHook is not a function
TypeError: resolver.ensureHook is not a function
    at ModulesInRootPlugin.apply (C:\Users\sh4dow\development\github\fructosedb\node_modules\enhanced-resolve\lib\ModulesInRootPlugin.js:15:27)
    at PathPlugin.apply (C:\Users\sh4dow\development\github\fructosedb\node_modules\awesome-typescript-loader\src\paths-plugin.ts:114:71)
    at webpack (C:\Users\sh4dow\development\github\fructosedb\node_modules\webpack\lib\webpack.js:37:12)
    at createServer (C:\Users\sh4dow\development\github\fructosedb\node_modules\react-styleguidist\scripts\create-server.js:27:19)
    at server (C:\Users\sh4dow\development\github\fructosedb\node_modules\react-styleguidist\scripts\server.js:5:21)
    at commandServer (C:\Users\sh4dow\development\github\fructosedb\node_modules\react-styleguidist\bin\styleguidist.js:123:19)
    at Object.<anonymous> (C:\Users\sh4dow\development\github\fructosedb\node_modules\react-styleguidist\bin\styleguidist.js:72:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
error Command failed with exit code 1.

I've resolved it locally by using this configuration and updating the versions of awesome-typescript-loader and typescript to the latest ones. (The latter just to get rid of most deprecation warnings)

If you want me to, I'll prepare a PR for this.

andywer commented 6 years ago

Hey @s-h-a-d-o-w, thanks for reporting!

Which version of webpack-blocks are you running? The v2 prerelease?

s-h-a-d-o-w commented 6 years ago

You're welcome. :) Yes, I am using 2.0.0-alpha.

andywer commented 6 years ago

Cool. Yeah, a PR would be appreciated :)

andywer commented 6 years ago

(Please target the PR to the release-2.0 branch if you create one šŸ˜‰)