swc-plugin-ignore-import
v0.1.0
Published
SWC plugin to ignore and remove certain imports based on configuration
Downloads
2
Readme
SWC plugin to ignore and remove certain imports based on configuration
Inspired from https://www.npmjs.com/package/babel-plugin-ignore-import and since I needed this functionality, as it was blocker was moving to SWC.
const swc = require("@swc/core");
const PluginIgnoreImport = require("swc-plugin-ignore-import").default;
const { code } = swc.transformSync(src, {
filename: "source-file-name-for-sourcemap.js",
sourceMaps: true,
jsc: {
parser: {
syntax: "ecmascript",
},
target: "es2015",
},
plugin: (m) =>
new PluginIgnoreImport({
pattern: /\.s?css$/,
}).visitProgram(m),
});
Code style
npx prettier --write index.ts
Version history
License
Licensed under the MIT license.
Copyright (c) Juga Paazmaya [email protected]