Import paths / file names with "type extensions" do not work. #3
Description
If an import contains additional dots, i.e if you are using a _"type exentensions"_™ this plugin will not add the actual extensions.
import { somethingBackFromOther } from '../lib/something.lib'
should be transformed to import { somethingBackFromOther } from '../lib/something.lib.js'
, but it stays untouched.
However those filenames are quite common in a lot of frameworks (i.e. component.style.ts
, component.test.ts
, ...), actually the default extension for Jest tests is test.js
(and thus in typescript test.ts
).
I have added test cases at least for the imports at https://github.com/ChristianUlbrich/babel-plugin-add-import-extension that will fail.
This needs some consideration on how to combine this with the ability to replace an extension. I skimmed through the code and for me personally it is pretty dense (asi, nested destructuring, no comments, ...) so I can't come up with an easy fix w/o re-writing larger parts of it. Maybe @karlprieb can fix this in an instant. :)