preboot / angular-webpack

A complete, yet simple, starter for Angular v2+ using webpack
MIT License
1.29k stars 556 forks source link

Webpack unable to find ES6 modules after a rename/move/delete #311

Closed mtfurlan closed 7 years ago

mtfurlan commented 7 years ago

If I move or rename a module, webpack throws errors about how it can't find the moved module.

[at-loader] src/app/event/event-detail/event-detail.service.ts:3:29 
    TS2307: Cannot find module './event-detail'.

In this example, src/app/event/event-detail/event-detail.service.ts and src/app/event/event-detail/event-detail.ts were moved or deleted.

It seems like this may just be an issue with webpack, but I don't find this issue in a few different searches so I'm wondering if it's an issue with this seed.

How should I go about debugging this? It's not reasonable to have to restart webpack every time I check out a different branch.

Foxandxss commented 7 years ago

Restarting webpack after moving different branches sounds reasonable to me. Now, if that were happening say after a copy and paste, sounds more weird.

mtfurlan commented 7 years ago

Well, if I just delete a module that isn't used yet with rm, it still happens. Checking out a new branch is just the use case I hit more.

mcescalante commented 7 years ago

There is a (new) discussion in the webpack-cli issues about if "watching" a webpack config file for changes and reloading it should be added as a feature: https://github.com/webpack/webpack-cli/issues/15

Until then, using the "nodemon trick" to restart webpack-dev-server after a file change will work fine. See here for that trick: https://github.com/webpack/webpack-dev-server/issues/440#issuecomment-205757892