We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To be able to support @emtion/react's css prop on React elements, esbuild's config needs to be slightly tweaked.
@emtion/react
css
I managed to patch Remix's https://github.com/remix-run/remix/blob/main/packages/remix-dev/compiler.ts and https://github.com/remix-run/remix/blob/main/packages/remix-dev/compiler/shims/react.ts to make it work in dev but ideally it we would be possible to configure esbuild from remix.config.js (or similar).
esbuild
remix.config.js
It could be a jsx factory specific thing:
module.exports = { [...], jsxFactory: "jsx", reactShim: "path/to/shim" }
or just allowing the whole esbuild configuration to be extended:
module.exports = { [...], esbuildConf: { jsxFactory: "jsx", inject: ["path/to/shim"] } }
To be able to support custom JSX factories like emotion's one.
The text was updated successfully, but these errors were encountered:
Here's the patch I created for v1.1.3:
diff --git a/compiler/shims/react.ts b/compiler/shims/react.ts index eb0f102ecb7ea96274f00ad964393c86981dbdf9..a65ef8521b1dedf754adc1013f5c32799b6d5136 100644 --- a/compiler/shims/react.ts +++ b/compiler/shims/react.ts @@ -1,2 +1,4 @@ +import { jsx } from "@emotion/react"; import * as React from "react"; -export { React }; + +export { jsx, React }; diff --git a/compiler.js b/compiler.js index 1a6cabc2ae7102055cba88cb57084ba7ec8642b4..3cf652f33445a4b198b5f10b2915300654181e88 100644 --- a/compiler.js +++ b/compiler.js @@ -297,6 +297,7 @@ async function createBrowserBuild(config, options) { platform: "browser", format: "esm", external: externals, + jsxFactory: "jsx", inject: [reactShim], loader: loaders.loaders, bundle: true, @@ -329,6 +330,7 @@ async function createServerBuild(config, options) { format: config.serverModuleFormat, mainFields: config.serverModuleFormat === "esm" ? ["module", "main"] : ["main", "module"], target: options.target, + jsxFactory: "jsx", inject: [reactShim], loader: loaders.loaders, bundle: true,
Sorry, something went wrong.
jsxImportSource
No branches or pull requests
What is the new or updated feature that you are suggesting?
To be able to support
@emtion/react
'scss
prop on React elements, esbuild's config needs to be slightly tweaked.I managed to patch Remix's https://github.com/remix-run/remix/blob/main/packages/remix-dev/compiler.ts and https://github.com/remix-run/remix/blob/main/packages/remix-dev/compiler/shims/react.ts to make it work in dev but ideally it we would be possible to configure
esbuild
fromremix.config.js
(or similar).It could be a jsx factory specific thing:
or just allowing the whole
esbuild
configuration to be extended:Why should this feature be included?
To be able to support custom JSX factories like emotion's one.
The text was updated successfully, but these errors were encountered: