-
Notifications
You must be signed in to change notification settings - Fork 61
import xxx = require('xxx')
seems to be silently removed
#80
Comments
I just ran into this myself. Are there any workarounds? I'm trying to do the following: import uniq = require('lodash/uniq'); Attempting to tree-shake |
This does not look like valid TypeScript syntax to me as it is mixing the ES module format with the CommonJS module format. Does import uniq from 'lodash/uniq'; work for you? You may also need |
It is valid TypeScript. This is how TypeScript imports CommonJS. See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5099333846e466f1583b5e254dea18c9b7384325/types/lodash/lodash-tests.ts#L1-L2 and a number of other CommonJS typings in the definitely typed repo. |
I see. It seems this is stripped out by TypeScript if the module type is |
I have added this approach to #124 and documented it in the README |
Versions
rollup.config.js
test.ts
(input)test.js
(output)The text was updated successfully, but these errors were encountered: