swc plugin to add module prefix.
@swc/core: ">=1.3.42"
[
"@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';