question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not import `config.js` from inside the client-side code.

See original GitHub issue

In 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:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
charyordecommented, May 12, 2017

Kind of super flexibile though. store.getState().config. I like how it’s now part of a server-side resource.

0reactions
langpavelcommented, May 11, 2017

@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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found