Skip to content

paazmaya/swc-plugin-ignore-import

Repository files navigation

SWC plugin to ignore and remove certain imports based on configuration

Rust CI Code Smells codecov

Inspired by babel-plugin-ignore-import, and since I needed this functionality it was a blocker to moving fully utilizing SWC.

import { transformSync } from "@swc/core";

const output = transformSync(input, {
  jsc: {
    experimental: {
      plugins: [
        [
          "swc-plugin-ignore-import",
          {
            pattern: ".scss$",
          }
        ]
      ],
    },
  },
});

Code style

cargo fmt

Testing

First make sure that the correct Wasm target for Rust compiler is being installed:

rustup target add wasm32-wasip1

Node.js usage tests are written in usage.test.js and can be executed:

cargo build-wasi
npm install
npm test

The same approach is used at GitHub Actions, defined in .github/workflows/build-and-test.yml.

Version history

Changes happening across different versions and upcoming changes are tracked in the CHANGELOG.md file.

License

Licensed under the MIT license.

Copyright (c) Juga Paazmaya [email protected]

About

SWC plugin to ignore and remove certain imports based on configuration

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •