1.4.2 • Published 1 year ago
replace-absolute-path v1.4.2
replace-absolute-path
- usage:
const fs = require('fs');
const replacePath = require('replace-absolute-path');
(async function () {
const srcDir = path.resolve(__dirname, '../src');
const libDir = path.resolve(__dirname, '../lib');
replacePath({
inputDir: srcDir,
outputDir: libDir,
// includeExts: replacePath.DEFAULT_EXTS.concat(['.md']),
afterReplaced: () => {
console.log('--------------------------------------------------------------------------');
console.log('| all files import statements has been transformed to relative path ^_^ |');
console.log('--------------------------------------------------------------------------');
},
});
})();
now your file import statements changed
// if current file position is /src/components/Editor/index.js
// config file position is /src/config.js
import xx from 'configs/xx';
// change to
import xx from '../../configs/xx';
export { default as xx } from 'configs/xx';
// change to
export { default as xx } from '../../configs/xx';
import { xx } from 'configs/xx';
// change to
import { xx } from '../../configs/xx';
1.4.2
1 year ago
1.4.1
1 year ago
1.4.0
1 year ago
1.3.9
1 year ago
1.3.7
1 year ago
1.3.8
1 year ago
1.3.6
1 year ago
1.3.5
1 year ago
1.3.4
2 years ago
1.3.3
2 years ago
1.3.2
2 years ago
1.2.3
2 years ago
1.3.1
2 years ago
1.2.2
2 years ago
1.3.0
2 years ago
1.2.1
2 years ago
1.2.0
3 years ago
1.1.1
3 years ago
1.0.2
3 years ago
1.1.0
3 years ago
1.1.2
3 years ago
1.0.3
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago