Can't build with dfa 1.2.0
See original GitHub issueDescribe the bug I have a rails project with react, using webpacker and mostly babel for transforming javascript. When I try to use the @react-pdf/renderer in the project, the compiling of webpacker fails. I get the following error:
ERROR in ./node_modules/@react-pdf/fontkit/dist/fontkit.browser.es.js 8713:23-35 "export 'default' (imported as 'StateMachine') was not found in 'dfa'
To Reproduce 0. Setup a Ruby on Rails project with react, i.e. with react-rails
- yarn install @react-pdf/renderer
- import { Page, Text, View, Document, StyleSheet } from ‘@react-pdf/renderer’ in React-Component
- Compile the project with webpacker or ./bin/webpack-dev-server
Indeed, if I look in the file /node_modules/@react-pdf/fontkit/dist/fontkit.browser.es.js line 6, where it tries to load the StateMachine it really looks like a bug to me.
import StateMachine from 'dfa'
And then in ./node_modules/dfa/index.js The last line: module.exports = StateMachine is trying to export as commonJS and not as es-format.
Am I overseeing something here? Or is this actually a bug? I currently try to do some babel or webpack-config to solve this problem, but it seems like an issue to me.
Expected behavior Make this instantly work, without the need to do additional webpack or babel config.
Desktop (please complete the following information):
- React-pdf version [e.g. v1.1.0]
- @react-pdf/fontkit version 1.13.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
I solved it adding the
resolutions
section inpackage.json
"dfa": "1.1.0"
And of course the package with that version as well
Hm, it actually has an impact on installing react-pdf currently (fails to install), if my suspicion is correct. But yeah, I should try to adress this at dfa.