# swc-plugin-import-extension-resolver

> A SWC plugin to resolve import extensions. (e.g. `import 'foo'` -> `import 'foo.js'`)

Latest version **0.2.3** (published 2023-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install swc-plugin-import-extension-resolver
pnpm add swc-plugin-import-extension-resolver
yarn add swc-plugin-import-extension-resolver
bun add swc-plugin-import-extension-resolver
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2023-10-12 |
| First published | 2023-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | CaffeinePower |
| Maintainers | cffnpwr |
| Keywords | swc-plugin |

## Links

- npm: https://www.npmjs.com/package/swc-plugin-import-extension-resolver
- Repository: https://github.com/cffnpwr/swc-plugin-import-extension-resolver
- Homepage: https://github.com/cffnpwr/swc-plugin-import-extension-resolver#readme
- Issues: https://github.com/cffnpwr/swc-plugin-import-extension-resolver/issues
- npm.io page: https://npm.io/package/swc-plugin-import-extension-resolver

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.2.3 (latest) — 2023-10-12
- 0.2.2 — 2023-10-12
- 0.2.1 — 2023-06-17
- 0.2.0 — 2023-06-16
- 0.1.1 — 2023-06-15
- 0.1.0 — 2023-06-15

## README

# swc-plugin-import-extension-resolver

A SWC plugin to resolve import extensions.

TypeScriptのトランスパイル時にローカルの`.ts`ファイルを`.js`に変換するためのSWCプラグインです。

## Install

```sh
npm install --save-dev swc-plugin-import-extension-resolver
```

or

```sh
yarn add -D swc-plugin-import-extension-resolver
```

or

```sh
pnpm add -D swc-plugin-import-extension-resolver
```

## Usage

### .swcrc

```json
{
  "jsc": {
    "experimental": {
      "plugins": [
        ["swc-plugin-import-extension-resolver", {
          "aliases": [
            "@/*",
            "$/*"
          ]
        }]
      ]
    }
  }
}
```

オプション`aliases`に`jsc.paths`で指定したエイリアスと同じものを指定することで、エイリアスに対しても変換を行なうことができます。
`aliases`は設定せずにオプションなしでも使用可能です。

## Transform example

### Before

```ts
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";

const bootstrap = async () => {
  const app = await NestFactory.createApplicationContext(AppModule);
  await app.close();
};
bootstrap().catch((error: Error) => {
  throw error;
});
```

### After

```ts
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module.js";
const bootstrap = async ()=>{
    const app = await NestFactory.createApplicationContext(AppModule);
    await app.close();
};
bootstrap().catch((error)=>{
    throw error;
});
```

---
_Source: https://npm.io/package/swc-plugin-import-extension-resolver · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
