1.23.0 • Published 8 months ago
swc-plugin-transform-remove-imports v1.23.0
swc-plugin-transform-remove-imports
A Rust versions of babel-plugin-transform-remove-imports.
Modular import plugin for swc. Also works for cjs to delete imported CSS to avoid compilation errors.
Installation
npm:
npm i -D swc-plugin-transform-remove-imports
yarn:
yarn add -D swc-plugin-transform-remove-imports
You can check the compatibility of versions on https://plugins.swc.rs/
Usage
Via .swcrc
{
"jsc": {
"experimental": {
"plugins": [
[
"swc-plugin-transform-remove-imports",
{
"test": "\\.(less|css)$"
}
]
]
}
}
}
Support import
// Input Code
import "./index.less";
import "./index.main.less";
import { Button } from "uiw";
import { Select } from "@uiw/core";
// Output ↓ ↓ ↓ ↓ ↓ ↓
import { Button } from "uiw";
import { Select } from "@uiw/core";
Output Result
- import './index.less';
- import './index.main.less';
import { Button } from 'uiw';
import { Select } from '@uiw/core';
Support require
Options
test
Type: Regex | Regex[]
A regular expression to match the imports that will be removed.
remove
Optional. Possible values: 'effects'
Removing only side effects imports.
// Input Code
import "foo";
import Foo from "foo";
// Output Code ↓ ↓ ↓ ↓ ↓ ↓
import Foo from "foo";
License
1.19.0
9 months ago
1.18.0
10 months ago
1.21.0
9 months ago
1.22.0
8 months ago
1.20.0
9 months ago
1.23.0
8 months ago
1.15.0
11 months ago
1.14.0
11 months ago
1.17.0
10 months ago
1.16.0
10 months ago
1.13.0
1 year ago
1.12.1
1 year ago
1.12.0
1 year ago
1.11.0
1 year ago
1.10.0
2 years ago
1.9.0
2 years ago
1.8.0
2 years ago
1.7.0
2 years ago
1.6.0
2 years ago
1.5.0
2 years ago
1.4.0
2 years ago
1.3.0
2 years ago
1.2.0
2 years ago
1.1.0
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago