Import Add Js Extensions

1.0.0Last update Dec 8, 2024
by@kamilogorek

import-add-js-extensions

This codemod adds .js file extension to relative, top-level imports.

Before

import foo from "package-import";
import custom from "@/custom/path";
import { bar } from "./relative-import";
import type Baz from "../parent-import";
import { type Qoux } from "./nested/import";
import * as existing from "./already-existing.js";

After

import foo from "package-import";
import custom from "@/custom/path";
import { bar } from "./relative-import.js";
import type Baz from "../parent-import.js";
import { type Qoux } from "./nested/import.js";
import * as existing from "./already-existing.js";

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now