It looks like the [email protected] export is not being correctly aliased by Webpack with:
resolve: {
alias: {
'react': 'preact/compact',
'react-dom': 'preact/compact',
},
},
Webpack throws:
Module not found: Error: Can't resolve 'react' in <module>
Repro:
git clone [email protected]:damianobarbati/webapp-kit.git
yarn install
yarn build:dev:hot
Aliasing:
https://github.com/damianobarbati/webapp-kit/blob/master/config/webpack.config.js#L39
Am I missing something stupid?
It's preact/compat, not preact/compact. I sent you a PR.
TBH we've seen quite a few folks misspelling. Might be worth having a /compact alias that throws or something.
Ops! I actually tried both, the (correct) latter results in
Can't import the named export 'Component' from non EcmaScript module (only default export is available)
Solved with your suggestion here:
https://github.com/developit/preact/issues/1321#issuecomment-469522281
It's
preact/compat, notpreact/compact. I sent you a PR.TBH we've seen quite a few folks misspelling. Might be worth having a
/compactalias that throws or something.
Just FYI I miss spelled it.... It took me some time racking my head and then finally googling to this issue.
Most helpful comment
It's
preact/compat, notpreact/compact. I sent you a PR.TBH we've seen quite a few folks misspelling. Might be worth having a
/compactalias that throws or something.