Skip to content

Commit

Permalink
🤘 Only export with prefix if multiple formats
Browse files Browse the repository at this point in the history
  • Loading branch information
VandeurenGlenn committed Feb 25, 2017
1 parent 59ccf3f commit 9b7630f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ export default class Builder {
if (config.format && typeof config.format === 'object') {
const formats = config.format;
for (let format of formats) {
this.bundle(config, format);
let dest = config.dest;
if (format !== 'iffe') {
switch (format) {
case 'cjs':
dest = dest.replace('.js', '-node.js');
break;
case 'es':
case 'amd':
dest = dest.replace('.js', `-${format}.js`);
break;
}
}
this.bundle(config, dest, format);
}
} else {
this.bundle(config, config.format);
this.bundle(config, config.dest, config.format);
}
}

bundle(config, format) {
let dest = config.dest;
if (format !== 'iffe') {
switch (format) {
case 'cjs':
dest = dest.replace('.js', '-node.js');
break;
case 'es':
case 'amd':
dest = dest.replace('.js', `-${format}.js`);
break;
}
}
bundle(config, dest, format) {
rollup({
entry: `${process.cwd()}/${config.src}`,
// Use the previous bundle as starting point.
Expand Down

0 comments on commit 9b7630f

Please sign in to comment.