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.

Exclude from production build

See original GitHub issue

I am currently trying to remove your library from production builds since it is not needed. I wrapped the install statements:

const installExtensions = async () => {
  if (process.env.NODE_ENV === 'development') {
    const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];

    return Promise
      .all(extensions.map(name => install.default(install[name])))
      .catch(console.log);
  }
  return Promise.resolve();
};

For some odd reasons, the dependency still stays in production. Is it intended to?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MarshallOfSoundcommented, Mar 28, 2017

The way most people do it is to make electron-devtools-installer a devDep and then try catch the require 👍

1reaction
MarshallOfSoundcommented, Mar 28, 2017

@SirWindfield If you are using webpack with Electron (for whatever reason) then the code you would want is this.

const installExtensions = async () => {
  if (process.env.NODE_ENV !== 'production') {
    const install = require('electron-devtools-installer');
    const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];

    return Promise
      .all(extensions.map(name => install.default(install[name])))
      .catch(console.log);
  }
  return Promise.resolve();
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to exclude code from production in build-time?
I want when I build my app using webpack configuration to exclude this code. javascript · node.js · webpack · Share.
Read more >
Is there a way to exclude files from the bundle in production?
I have some mock data which I use for testing in dev but it's getting bundled with the rest of my code in...
Read more >
Exclude Mirage from Vue CLI production builds
Since Mirage is a development tool, you should configure Vue CLI to exclude it when building your app for production. This keeps the...
Read more >
How to: Exclude Files from the Build - MSBuild | Microsoft Learn
Use conditions to exclude a file or directory from the inputs for a build ... If there are items that you want to...
Read more >
Blog Exclude Drafts From Production | janosh.dev
When filtering out draft content for the production build, it's best to do so as close to the source as possible. There might...
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