Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with TypeScript? #62

Open
jsalonen opened this issue Jul 15, 2016 · 1 comment
Open

Using with TypeScript? #62

jsalonen opened this issue Jul 15, 2016 · 1 comment

Comments

@jsalonen
Copy link

I'm using TypeScript and would like to use longjohn conditionally just in dev mode. Documentation suggests using conditional require:

if (process.env.NODE_ENV !== 'production'){
  require('longjohn');
}

However, TypeScript imports are restricted to top-level, making it impossible to do such conditional check without falling back to commonJS-style require.

There is also a related issue: #61 - having the ability to disable longjohn after require would be a sufficient fix.

@Flarna
Copy link

Flarna commented Oct 5, 2016

Typescript support conditional loading.
See section Optional Module Loading and Other Advanced Loading Scenarios at https://www.typescriptlang.org/docs/handbook/modules.html for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants