cra-preact
cra-preact copied to clipboard
Can't reexport the named export 'renderToString'
Describe the bug
I have this error when I yarn start
and yarn build
.
Can't reexport the named export 'renderToString' from non EcmaScript module (only default export is available)
This is linked to this comment: https://github.com/preactjs/preact/issues/1399#issuecomment-472561720
To Reproduce Steps to reproduce the behavior:
- Install preact: 10.5.14
- Install preact-render-to-string: 5.1.19
- Try to compile
Expected behavior It should build the project.
Versions
- react-scripts v : 4.0.3
- cra-preact v : 0.4.0
What I did to resolve the issue, but only temporarily, is to add webpack-modules
in node_modules/cra-preact/src/(start|build).js
.
Like the following:
const hookIntoRequire = require('require-in-the-middle')
+ const WebpackModules = require('webpack-modules')
hookIntoRequire(['react-scripts/config/webpack.config'], configFactory => {
const config = configFactory('production')
config.resolve.alias['react'] = 'preact/compat'
config.resolve.alias['react-dom'] = 'preact/compat'
config.resolve.alias['react-dom/test-utils'] = 'preact/test-utils'
+ config.plugins.push(new WebpackModules())
return () => config
})
require('react-scripts/scripts/build')