-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Uncaught ReferenceError: production is not defined #466
Comments
This is because you are not quoting your command-line arguments correctly for the shell you are using. From the readme:
You need to use Another alternative could be to use a JavaScript build script if you don't want to use command-line arguments. |
@evanw thanks! It works like a charm 🙌. Maybe it worths mentioning that cmd way won't work well on Windows shells ;) BTW, do you plan to support using |
What do you mean? Do you mean something like |
@evanw the problem is I'm trying to use <svg {...props}>
<use xlinkHref={svg} />
</svg> I also tried to use The Hoever, |
I've made a workaround using |
This actually does sound like the best way to do it. I think it should be faster than running the svg file through the jsx transform since it uses the browser’s native parser. In the future when the plugin API is released (issue #111), it will be possible to write an esbuild plugin to do what you’re proposing (interpret the svg file as a module that returns the contents as a jsx expression) if you still want to do that. |
I just ran into this issue, and found this response. This is a little confusing, but I'm glad there's a workaround |
Yeah sorry about this. The syntax of the define feature means this mistake is easy to make. I should add a warning for this case. Note that if you're using esbuild via the CLI, the specific quote syntax described above won't work on Windows. The documentation has been changed to use backslash escapes instead, which I think should work on Windows too: https://esbuild.github.io/api/#define. |
thanks - got the build working now! 10 boarding-school students will be happy you helped me get their websocket-server working ❤️ |
As this is the only post on the internet dealing with this specific error, I'm going to come back and add a comment here to say that I'm in the process of converting a CRA app to use esbuild and cannot get the
And the exact same behaviour (deduced with sourcemap) as the OP is what I'm running into. Any suggestions given current version? |
@donburks change the define to define: {
'process.env.NODE_ENV': '"production"'
} |
This definitely resolved the issue (and illuminated three or four new ones that I get to track down), so thank you. I wouldn't have thought the same double-quote issue would have applied inside the build script, but I will know for the future. |
This is already in the documentation linked above:
|
Hi! This is incredibly fast 🚀 🤘, but ...
... I'm trying to get it working with react. I'm using this example, and it compiles successfully. However, when adding
out.js
to html document (i.e.<script src="out.js"></script>
) I'm havingUncaught ReferenceError: production is not defined
error.Here you can check a short demo I recorded on my local machine. Thanks!
UPD: Adding
--sourcemap
flag you can see the error occurs hereThe text was updated successfully, but these errors were encountered: