I have encountered an issue where a specific import fails to work during direct compilation, but functions properly after saving the source on VS Code.
If I delete the node_modules/.cache
folder and run the command:
yarn serve
It compiles without errors, however, the browser shows a runtime error:
Uncaught TypeError: getParamNames is not a function
at eval (webpack-internal:///../api/src/clients/base.ts:116)
[more error details...]
If I continue compiling the application without any changes, the error persists. However, if I edit base.ts
in VS Code, change the import to something incorrect, then revert it back, it compiles successfully. Even after restarting the server, the error does not reappear.
If I delete the node_modules/.cache
again or wait for it to expire, the cycle repeats.
base.ts:
[content of base.ts]
package.json:
[content of package.json]
tsconfig.json:
[content of tsconfig.json]
vue.config.js:
[content of vue.config.js]
babel.config.js:
[content of babel.config.js]
Addendum (2020-03-20)
I was able to partially resolve this by creating an explicit type declaration and adjusting the import statement. This solution worked for the frontend built with vue-cli
, but not for the backend built with ts-node-dev
.
[error message from ts-node-dev]
This issue seems similar to: