I'm getting compilation errors caused by the tree-shaking of lodash.
Follow these steps:
-
Update your tsconfig.json to have
allowSyntheticDefaultImports: true
property in compilerOptions. This property allows users to import CommonJS modules as default imports.- If you have compilation error like
TypeError: find_1.default is not a function
when running tests you might need to addesModuleInterop: true
to your compilerOptions. Or you can try Solution #2 from this article.
- If you have compilation error like
-
After updates in tsconfig.json change imports of lodash to such way in all files:
import forEach from “lodash/forEach”;
- https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/
- https://www.typescriptlang.org/docs/handbook/compiler-options.html
Not sure which version of node should I use.
It is recommended to use version which is on CircleCI builds which is currently 16.18.0