esxjs / to-esx

Converts JSX and `React.createElement` into ESX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing esx.register of imported component

irudoy opened this issue · comments

There are no esx.register call when importing component with import statement.

test('JSX component registration – import', async ({ is }) => {
  const src = [
    `import React from 'react'`,
    `import Foo from './foo'`,
    'module.exports = <div><Foo/></div>'
  ].join('\n')
  const esx = [
    `const esx = require('esx')()`,
    `import React from 'react'`,
    `import Foo from './foo'`,
    'esx.register({ Foo })',
    'module.exports = esx `<div><Foo/></div>`'
  ].join('\n')
  is(convert(src), esx)
})
--- wanted                                
+++ found                                 
const esx = require('esx')()             
import React from 'react'                
import Foo from './foo'                  
-esx.register({ Foo })                    
module.exports = esx `<div><Foo/></div>`