Skip to content

swanide/swc-require-rename

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@swanide/swc-require-rename

swc plugin to add module prefix.

@swc/core: ">=1.3.42"

config

[
    "@swanide/swc-require-rename",
    {
        "modulePrefix": "@swan-module/"
    }
]

source:

import fs from 'fs';
import {resolve} from 'path';
import {debounce} from 'lodash';
const a = require('../abc');
require('/def');
require('./../def');
export * from 'exp1';
export {ee} from 'exp1';

transformed:

"use strict";
import fs from '@swan-module/fs';
import {resolve} from '@swan-module/path';
import {debounce} from '@swan-module/lodash';
const a = require('@swan-module/../abc');
require('@swan-module//def');
require('@swan-module/./../def');
export * from '@swan-module/exp1';
export {ee} from '@swan-module/exp1';

Releases

No releases published

Packages

No packages published

Languages