Skip to content

Commit

Permalink
Fix: throw a warning when no entrypoint is found (#843)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Miller <[email protected]>
Co-authored-by: nafees nazik <[email protected]>
  • Loading branch information
3 people authored Jun 5, 2021
1 parent 86371f0 commit 680c25c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import { resolve, relative, dirname, basename, extname } from 'path';
import camelCase from 'camelcase';
import escapeStringRegexp from 'escape-string-regexp';
import { blue } from 'kleur';
import { blue, red } from 'kleur';
import { map, series } from 'asyncro';
import glob from 'tiny-glob/sync';
import autoprefixer from 'autoprefixer';
Expand Down Expand Up @@ -130,7 +130,10 @@ export default async function microbundle(inputOptions) {
);

const targetDir = relative(cwd, dirname(options.output)) || '.';
const banner = blue(`Build "${options.name}" to ${targetDir}:`);
const sourceExist = options.input.length > 0;
const banner = sourceExist
? blue(`Build "${options.name}" to ${targetDir}:`)
: red(`Error: No entry module found for "${options.name}"`);
return {
output: `${banner}\n ${out.join('\n ')}`,
};
Expand Down

0 comments on commit 680c25c

Please sign in to comment.