yeojz / metalsmith-react-templates

A metalsmith plugin to render files using React / Preact / JSX based templates.
MIT License
92 stars 17 forks source link

reactTemplate is not a function #40

Closed chadhahn closed 7 years ago

chadhahn commented 8 years ago

Upgrading the "example" app to version 5.0.1 and build.js throws "reactTemplate is not a function". What is the process to migrate to the new version?

yeojz commented 8 years ago

@chadhahn It should work if you replace require('metalsmith-react-templates') with require('metalsmith-react-templates').default

This is due a change in the behaviour of babel which removed default module.exports assignment. (https://github.com/babel/babel/issues/2212)

Haven't had the time to update the examples yet. Will add an interop file in a future release to make it more explicit.

yeojz commented 7 years ago

@chadhahn

Already released a require('metalsmith-react-templates/interop') before v6. Will be closing this.

If you're still facing any issues, don't hesitate to open a new issue. Thanks.