Allow change import in es2015 mode
Closed this issue · 5 comments
JoniJnm commented
Hi,
I need the change the replace of the import in es2015 mode (because of typescript config).
Can you add an option to change the replace by:
return "import _" + lodashModule + " from \"lodash/" + lodashModule + "\";\n";
?
Thanks!
ckotzbauer commented
Hi,
so you need instead of this as result:
import * as _each from "lodash/each";
this here with _each
as default export?
import _each from "lodash/each";
JoniJnm commented
With import * as _each from "lodash/each";
works too, but the extension is ts
, so it's replaced by require('lodash/each')
.
So maybe with an option like importMode
with
- legacy (ts => commonjs, js => es6)
- commonjs
import a = require('a')
(o maybevar a = require('a')
) - es6
import * as a from 'a'
orimport a from 'a'
(both works with lodash because it exports the function as default too) - auto Try to use the same way as is in code with regex?
ckotzbauer commented
Yes, I can implement this different behavior.
ckotzbauer commented
@JoniJnm Released in 1.1.0
JoniJnm commented
Thanks!