Closed rzschoch closed 3 years ago
I try to omit the h imports for all my components while using a webpack/babel build process.
Following the preact documentation (https://preactjs.com/guide/v10/getting-started#integrating-into-an-existing-pipeline) for using preact with webpack I get this error: Uncaught ReferenceError: h is not defined.
Uncaught ReferenceError: h is not defined
An old issue (https://github.com/preactjs/preact-compat/issues/161) mentions this solution that is also working for me:
new webpack.ProvidePlugin({ h: ['preact', 'h'], })
Is there now a nicer solution to this problem?
You can use the new automatic JSX runtime if you want to omit imports:
// babel config ["@babel/plugin-transform-react-jsx"], { "runtime": "automatic", "importSource": "preact" }]
I try to omit the h imports for all my components while using a webpack/babel build process.
Following the preact documentation (https://preactjs.com/guide/v10/getting-started#integrating-into-an-existing-pipeline) for using preact with webpack I get this error:
Uncaught ReferenceError: h is not defined
.An old issue (https://github.com/preactjs/preact-compat/issues/161) mentions this solution that is also working for me:
Is there now a nicer solution to this problem?