Skip to content

Commit

Permalink
fix: try to fix resolve again
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed May 16, 2020
1 parent 827c32c commit 57dfa96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -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
}
}
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 57dfa96

Please sign in to comment.