For bundle size optimization instead of getting components from the lib folder, I am importing it from the es folder.
Example:
import Modal from 'antd/es/modal';
So on writing test cases it is giving me the following error
SyntaxError: Cannot use import statement outside a module
I have gone through related questions possibly duplicate but couldn't resolve it with my current implementation as it does not fall to global scope.
So my question is, Is there any way to achieve this
I tried referring to the following links too but no help,
https://github.com/reactstrap/reactstrap/blob/master/package.json#L21 https://medium.com/@fredriccliver/syntaxerror-cannot-use-import-statement-outside-a-module-69182014b8c6
antd
import will use ES modules in Webpack build. This can save you the trouble. Otherwise you'll have to exclude antd/es from Jest transformIgnorePatterns to transpile them. This can bring other problems. – Clavichord"transformIgnorePatterns": ["node_modules/(?!(.*antd/es)/)"]
. – Clavichord