Skip to content

Is there a way to include danger JS files from other danger JS files? #1417

Answered by fbartho
jaymzh asked this question in Q&A
Discussion options

You must be logged in to vote

Only the "parent" Dangerfile can directly import { danger } from 'danger'

This is briefly documented here: https://github.com/danger/danger-js/blob/main/docs/usage/extending-danger.html.md#writing-your-plugin

Specifically:

Note, that you should not add a import { danger, et, cetera } from "danger" in your plugin. The dirty truth is that Danger completely ignores that at runtime, and just puts all of its exports inside the global context. You'll get compiler errors, or confusing shadow variable issues. So assume that it's there, and working fine

If you're using JS, and not Typescript, then you can just remove the "import…from 'danger'" lines, and it should work.

If you're using TypeScrip…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jaymzh
Comment options

@jaymzh
Comment options

@fbartho
Comment options

Answer selected by jaymzh
@jaymzh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants