ts-loader icon indicating copy to clipboard operation
ts-loader copied to clipboard

Conditional Imports

Open deryl27 opened this issue 11 years ago • 3 comments

@jbrantly
I was wondering if we can have a conditional imports

if(isDebugMode) { import('./a'); }

deryl27 avatar Aug 12 '15 18:08 deryl27

I created an example for how to do this: https://github.com/jbrantly/ts-loader/tree/master/test/conditionalRequire

jbrantly avatar Aug 13 '15 00:08 jbrantly

@jbrantly the Example is using the "require"

I was wondering if it is possible to import a module inside the 'if condition'

deryl27 avatar Aug 13 '15 17:08 deryl27

require is how you import a module. That example does import a module.

jbrantly avatar Aug 13 '15 18:08 jbrantly