shellscape/koa-webpack

using ts-node reloading does not reflect any changes made in the app

woldner opened this issue · 3 comments

I am unsure as to how to get this package working, either by using node or ts-node, so I've created a sample app/repo here:
https://github.com/jwldnr/koawebpack

This might not be the right place for this, but hopefully you can help me gain some clarity and this issue might help someone else in the future.

koawebpack

koa-webpack usage example

steps to reproduce

  • install dependencies using yarn
    -> cd koawebpack && yarn

  • compile using webpack, run app through node
    -> yarn use:node

ERROR in multi /src/App.ts
Module not found: Error: Can't resolve '/src/App.ts' in '/Users/m41n/source/repos/koawebpack'
 @ multi /src/App.ts app[0]
ℹ 「wdm」: Failed to compile.
  • use ts-node directly
    -> yarn use:ts-node

    App compiles ok, uses WDM.
    -> Browse to http://localhost:3000/ should display "hello world"
    -> Change body response in src/App.ts e.g. ctx.body = "hello updated world"
    -> terminal showing compile activity..
    .. then refresh http://localhost:3000/, still showing old response (not updated)

ℹ 「hot」: webpack: Bundle Invalidated
ℹ 「wdm」: Compiling...
ℹ 「hot」: webpack: Compiling...
ℹ 「hot」: webpack: Compiling Done
ℹ 「wdm」: Hash: a5292ae7e6ff2093ef76
Version: webpack 4.16.3
Time: 26ms
Built at: 07/31/2018 12:14:43 PM
 Asset      Size  Chunks  Chunk Names
app.js  31.5 KiB     app  app
Entrypoint app = app.js
[./src/App.ts] 1.14 KiB {app} [built]
[./webpack.config.ts] 905 bytes {app}
[koa] external "koa" 42 bytes {app}
[koa-webpack] external "koa-webpack" 42 bytes {app}
[path] external "path" 42 bytes {app}
[webpack] external "webpack" 42 bytes {app}
[webpack-node-externals] external "webpack-node-externals" 42 bytes {app}
[0] multi ./src/App.ts 28 bytes {app}
ℹ 「wdm」: Compiled successfully.
  • Node Version: 10.6.0
  • NPM Version: 6.1.0
  • koa Version: 2.5.2
  • koa-wepback Version: 5.1.0

Expected Behavior

when using koa-webpack to reload, it should reflect changes

Actual Behavior

compiles, but does not reflect changes

How can we reproduce the behavior?

use provided repo with the description above

Happy to review a PR that resolves this.

@jwldnr I met exactly the same problem! Re-compilation was done but none was changed.

  • Node: 10.12.0
  • koa: 2.6.1
  • koa-webpack: 5.1.0
  • typescript: 3.1.3

I was using Typescript + Babel + Webpack.

This is most likely a webpack configuration problem and not a direct issue with this middleware. Closing due to age.