This reverts commit 47f937e28f0a9d82997bd29630a8b3b92f44c0f5.
This commit had a few issues detected by the NativeScript project. It is
likely that they would have affected more users (and libraries) and so
it is safer to revert now and investigate later. Will likely be fixed in
6.2 by refactoring this whole plugin properly.
If there is a package.json we should also verify that it has a main or fesm field
to see if webpack would actually resolve it properly. Otherwise use the JavaScript
resolution.
This is a temporary fix and still has obvious limitations and issues. Namely, this
code is never run if there is only one path mapping, but that falls outside the
scope of this fix. Also, some people might have valid packages but want to resolve
to the JS file itself (which is what TypeScript does by default). These should be
fixed with a refactoring of the path plugin.
Fixes https://github.com/nativescript/nativescript-dev-webpack/issues/607
This should clean up the code a bit.
Note: at first I added the no-useless-cast rule, but after getting frustrated
with it (as it has many false positive), I decided to remove the rule but some
useless casts were removed so I let those in the PR.
With fixes; new now handles the parent initialize, visitor_spec now errors on
rejection, and nothing in the writeI18nOutFile() function was async so removed
the promise there entirely.