diff --git a/src/extractFromCode.js b/src/extractFromCode.js index 58172d7..87496a7 100644 --- a/src/extractFromCode.js +++ b/src/extractFromCode.js @@ -52,6 +52,7 @@ export default function extractFromCode(code, options = {}) { 'asyncGenerators', 'functionBind', 'functionSent', + 'dynamicImport', ], }); diff --git a/src/extractFromCode.spec.js b/src/extractFromCode.spec.js index f83a880..bb6166c 100644 --- a/src/extractFromCode.spec.js +++ b/src/extractFromCode.spec.js @@ -93,6 +93,14 @@ describe('#extractFromCode()', () => { '*', ], keys, 'Should return one key.'); }); + + it('should return the right key with dynamic import in code', () => { + const keys = extractFromCode(getCode('dynamicImport.js')); + + assert.deepEqual([ + 'key', + ], keys, 'Should return only one key.'); + }); }); describe('dynamic keys', () => { diff --git a/src/extractFromCodeFixtures/dynamicImport.js b/src/extractFromCodeFixtures/dynamicImport.js new file mode 100644 index 0000000..b6ce826 --- /dev/null +++ b/src/extractFromCodeFixtures/dynamicImport.js @@ -0,0 +1,7 @@ +/* eslint-disable */ + +import i18n from 'i18n'; + +import('other/file'); + +i18n(`key`);