synacor / preact-i18n

Simple localization for Preact.
BSD 3-Clause "New" or "Revised" License
206 stars 18 forks source link

withText usage : ReferenceError: assign is not defined #5

Closed Fridus closed 7 years ago

Fridus commented 7 years ago

When I use withText with functional components

preact-i18n.js:formatted:1 Uncaught (in promise) ReferenceError: assign is not defined
    at new <anonymous> (preact-i18n.js:formatted:1)
    at Component.doRender [as render] (preact-i18n.js:formatted:1)
    at renderComponent (preact-i18n.js:formatted:1)
    at setComponentProps (preact-i18n.js:formatted:1)
    at renderComponent (preact-i18n.js:formatted:1)
    at rerender (preact-i18n.js:formatted:1)
    at <anonymous>
  const Aaa = withText('button.next')(() => (<div>Hello</div>))
  render((
    <IntlProvider definition={definition}>
      <Aaa />
    </IntlProvider>
  ), el)

If you test with compiled file : test/index.js

import wrap, { intl, IntlProvider, Text, Localizer, withText } from '../dist/preact-i18n'

capture d ecran 2017-08-03 a 15 17 55

Fridus commented 7 years ago

Fixed by https://github.com/synacor/preact-i18n/pull/6

billneff79 commented 7 years ago

Fixed via #7 . Thanks for the PR @Fridus - good catch! I'll get a new release out as soon as I can get in touch with @developit

billneff79 commented 7 years ago

@Fridus Fix is now live on npm as preact-i18n@1.0.1

Fridus commented 7 years ago

Hi @billneff79 Thx, happy to read that :)