We had a similar problem for importing local dependencies. Here are some solutions:
- Publish your lib to npm or a private npm registry.
- Use `npm link` to link your local dependencies into your mendix widget
- Develop the mendix widget in the same repository as the JS lib, using something like lerna or yarn workspaces to treat them as separate modules. You would need to find a solution for the final step of the build process which expects to copy the .mpk into the mendix project ‘widgets’ folder. This location is normally specified in package.json as a relative path, but you might be able to override it in a custom webpack config file and have developers set an env. var pointing to their mendix project location?
We are currently doing option 2, although it does create an implicit dependency. The local packages are not listed in the mendix widgets’ package.json so a developer just has to ‘know’ that he needs to set up the linking. We may look at the possibility of option 3 in the future.
Typescript is not necessary for a mendix widget. If you scaffold it out with the yeoman generator, it will give you the option of using typescript or javascript