webpack change the electron render env
See original GitHub issueBug report
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
when i use process.env
with webpack in electron renderer process it show empty object {}
but without webpack process.env
working ok.
Other relevant information: webpack version: latest Node.js version: Operating System: ubuntu Additional tools: electron
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Configuration - electron-webpack
Defines the path to a process's or common usage directory, relative to the project's root directory. renderer.sourceDirectory can be null if you don't...
Read more >webpack - How do I set an Electron variable at compile time?
The idea is to expose a variable via webpack.DefinePlugin and you can do this for both your main and renderer processes. With electron-webpack...
Read more >NODE_ENV in webpack.renderer.additions.js #105 - GitHub
I'd like to use process.env.NODE_ENV in the webpack.renderer.additions.js file I specify in the "electronWebpack" part of my package.json, ...
Read more >Target | webpack
Compile for Electron for renderer process, providing a target using NodeTemplatePlugin with asyncChunkLoading set to true , FunctionModulePlugin for browser ...
Read more >Creating a React-based Electron application with ... - Medium
The electron-webpack project provides HMR support through Webpack and ... Now when you change the renderer source code, renderer.js will be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thanks @misterdev
I’ve executed
npm run eject
to see how webpack in configured in create-react-app. You can see here that inenv.js
it filters theprocess.env
keys including only those starting withREACT_APP_
,NODE_ENV
andPUBLIC_URL
.In the webpack configuration this filtered version of the
process.env
is replaced in the source code using theDefinePlugin
The process
process.env
is intentionally nearly empty, this isn’t a problem with Webpack but a create-react-app configuration 😃