-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
Use with webpack.DefinePlugin #55
Comments
same problem here!
|
It works in my project.
index.js:
then
I was trying to find a way to use DefinePlugin today, and just edit my craco file with your code in this issue, then it just works... |
You might be confused how the DefinePlugin works. It sets global variables during your build process. Thus, to have craco.config.js new webpack.DefinePlugin({
"process.env": { config: JSON.stringify(appConfig) }
}) index.js window.config = process.env.config; |
@ChemicalRocketeer @saostad do you still have the issue? |
Here is the solution in case anybody wants to use it:
and here is another example I added ant design to config, it's good if you need mix and match webpack plugins and babel plugins!
|
Does not work for me. |
1 similar comment
Does not work for me. |
If you want it to work you have to do this:
|
I'm trying to inject some constants into my app at build time under a global object called
config
, but no matter where I put my plugin, when I run the app I get'config' is not defined
. What am I doing wrong? Here's mycraco.config.js
:The text was updated successfully, but these errors were encountered: