diff --git a/src/errors.ts b/src/errors.ts index 21bee6020..4b2ee615a 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,12 +1,20 @@ import colors from 'colorette' export function handlError(error: any) { + if (error.loc) { + console.error( + colors.bold( + colors.red( + `Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}` + ) + ) + ) + } if (error.frame) { - console.error(colors.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)) console.error(colors.red(error.message)) console.error(colors.dim(error.frame)) } else { console.error(colors.red(error.stack)) } process.exitCode = 1 -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index a73069d2e..a5cb51499 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,8 +34,9 @@ export async function createRollupConfigs(files: string[], options: Options) { dts, }: { dts?: boolean - }): Promise<{ inputConfig: InputOptions; outputConfig: OutputOptions }> => { + }): Promise<{ name: string, inputConfig: InputOptions; outputConfig: OutputOptions }> => { return { + name: `dts: ${dts}, bundle: ${options.bundle}`, inputConfig: { input: files, preserveEntrySignatures: 'strict', @@ -70,7 +71,7 @@ export async function createRollupConfigs(files: string[], options: Options) { commonjsPlugin({ namedExports: { // commonjs plugin failed to detect named exports for `resolve`, TODO: report this bug - resolve: Object.keys(await import('resolve')), + resolve: ['sync', 'isCore', 'default'] }, // @ts-ignore wrong typing in @rollup/plugin-commonjs ignore: (name: string) => {