Skip to content
This repository was archived by the owner on Jul 10, 2021. It is now read-only.
This repository was archived by the owner on Jul 10, 2021. It is now read-only.

Import paths / file names with "type extensions" do not work. #3

Open
@ChristianUlbrich

Description

@ChristianUlbrich

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. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions