Refactor on build to avoid compilling unncessary SFCs and copy all SFCs to dist
parent
38fccede63
commit
05327ee35e
|
@ -3,15 +3,10 @@ const path = require('path');
|
|||
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
||||
if (file ==='package.json') {
|
||||
fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/package.json', 'dist/' + folder + '/package.json');
|
||||
}
|
||||
|
||||
if (file.endsWith('d.ts')) {
|
||||
if (file ==='package.json' || file.endsWith('d.ts') || file.endsWith('vue')) {
|
||||
fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file);
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json');
|
||||
|
|
|
@ -83,7 +83,7 @@ function addSFC() {
|
|||
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
||||
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
|
||||
if (/\.vue$/.test(file)) {
|
||||
if (/\.vue$/.test(file) && (name === folder)) {
|
||||
addEntry(folder, file, name);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue