Do not import `config.js` from inside the client-side code.
See original GitHub issueIn what scenario would I be able to avoid this?
if (process.env.BROWSER) {
throw new Error('Do not import `config.js` from inside the client-side code.');
}
I’m hitting this in the browser when I launch the app.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to use ES6 import (client-side JS) - Stack Overflow
The first thing to do is to put type="module" as an attribute of your <script> tag. Full example: <script type='module' src='module-a.mjs' ...
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >jsconfig.json Reference - Visual Studio Code
js doesn't reference a file b.ts explicitly (either using import or CommonJS modules), there is no common project context between the two files....
Read more >next.config.js: Runtime Configuration
Place any server-only runtime config under serverRuntimeConfig . Anything accessible to both client and server-side code should be under publicRuntimeConfig .
Read more >How webpack decides what to bundle - Jakob Lind
What about unused code, like functions that are not called? ... first thing webpack does is that it looks for the entry file...
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 FreeTop 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
Top GitHub Comments
Kind of super flexibile though.
store.getState().config
. I like how it’s now part of a server-side resource.@charyorde Ok, this is possible, why not? You will be able to change your config on any time by this action. But I’m not sure if all of your client side services are flexible like this too 😃 It is correct to pass general config variables statically, you can do this with Redux
initialState
or by global variable, both are correct in this edge case 😃