[esbuild] Error with Remix esbuild #1338
Labels
bug report 🦗
Issue is probably a bug, but it needs to be checked
bundler: webpack 📦
Issue is related to webpack bundler
needs: complete repro 🖥️
Issue need to have complete repro provided
Environment
Standard Remix template, latest Linaria, and remix-esbuild-override to allow the Linaria plugin to be injected into the Remix esbuild config.
Description
Using the
@linaria/esbuild
plugin with Remix results inReferenceError: React is not defined
I added some logs to
node_modules/@linaria/esbuild/dist/index.js
and discovered this error occurs because the input to the linaria esbuild plugin looks like this:Which the Linaria esbuild plugin transforms to this:
However
React
has not been imported so it fails to compileIf I add an import for React, then the code works:
I'm not sure the best way to resolve this as I am not that familiar with esbuild nor Remix, just exploring some options, but we use Linaria heavily in our current webpack build on a different project so I'm familiar with the general ways Linaria works with bundlers.
Reproducible Demo
https://codesandbox.io/p/sandbox/affectionate-bardeen-24zhgm?file=%2FREADME.md
The text was updated successfully, but these errors were encountered: