Original Discussion: https://www.pika.dev/npm/snowpack/discuss/431
/cc @pnfcre, @FredKSchott
Our dependency installer only detects dependencies that it can see imported in your source code. If a plugin like twin.macro adds an import to your built file for the first time, we won't be able to detect it during dev.
After we build a file in dev, we resolve its imports. This is where we should report missing packages. I had thought that we were already doing this, but it sounds like it may not be working as expected and the error message that you do get probably tells you to install the package as if it were missing (instead, it should give instructions to add to your snowpack config file under the "install" allowlist.
Okay, so the problem is that we detect it as a missing import, but then see that it exists inside your node_modules directory, and then assume "ah! this is just a new import that was added to your source file! It must be safe to just rerun our installer!" but then, of course, the installer doesn't see it in the source code because that was entire problem we ran into in the first place.
I'm actually not sure what the best move is here. One idea: if we attempt to resolve an unexpected import, we re-scan the source file and check that it was found in the source file and needs to be added to our allowlist.
We decided to remove this automatic handling for now, instead we just report a console error to the user giving them steps to resolve themselves.