Skip to content

Commit

Permalink
feat(rollup): fail build when externals are not allowed and cannot re…
Browse files Browse the repository at this point in the history
…solve id
  • Loading branch information
pi0 committed May 4, 2022
1 parent 6c8cae7 commit ff2dd44
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rollup/config.ts
Expand Up @@ -275,6 +275,16 @@ export const plugins = [
'import'
]
})))
} else {
rollupConfig.plugins.push({
name: 'no-externals',
async resolveId (id, from, options) {
const resolved = await this.resolve(id, from, { ...options, skipSelf: true })
if (!resolved || resolved.external) {
throw new Error(`Cannot resolve ${JSON.stringify(id)} from ${JSON.stringify(from)} and externals are not allowed!`)
}
}
})
}

// https://github.com/rollup/plugins/tree/master/packages/node-resolve
Expand Down

0 comments on commit ff2dd44

Please sign in to comment.