Refactor on build to avoid compilling unncessary SFCs and copy all SFCs to dist

pull/880/head
Cagatay Civici 2021-01-18 18:38:34 +03:00
parent 38fccede63
commit 05327ee35e
2 changed files with 3 additions and 8 deletions

View File

@ -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');

View File

@ -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);
}
});