preboot/angular-webpack

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

mtfurlan opened this issue · 3 comments

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.

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

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.

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: webpack/webpack-cli#15

Until then, using the "nodemon trick" to restart webpack-dev-server after a file change will work fine. See here for that trick: webpack/webpack-dev-server#440 (comment)