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.

react-optimize will cause a serious error

See original GitHub issue

In webpack.config.js, react-optimize will cause a serious error.

presets: [
  ['env', {
    // Optimize React code for the production build
    // https://github.com/thejameskyle/babel-react-optimize
      ...isDebug ? [] : ['react-optimize'],
  ],
],

Reproduce the problem:

git clone https://github.com/kriasoft/react-starter-kit.git
yarn

/src/routes/admin/index.js Remove redirect

yarn run build -- --release && node build/server.js

Visit http://localhost:3000/admin

5.png

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
frenzzycommented, Jun 9, 2017

I just looked at the compiled code and played with it a bit 😃

1reaction
frenzzycommented, Apr 20, 2017

Looks like React components should not be mixed with async/await or generators inside single scope, for example:

// src/routes/admin/index.js
import React from 'react';
import Layout from '../../components/Layout';

const title = 'Admin Page';

export default {

  path: '/admin',

  action() {
    return require.ensure([], require => require('./Admin').default, 'admin')
      .then(Admin => ({ // simple function without async/await or generators
        title,
        chunk: 'admin',
        component: <Layout><Admin title={title} /></Layout>,
      }));
  },

};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing Performance - React
If you're benchmarking or experiencing performance problems in your React apps, make sure you're testing with the minified production build. By default, React...
Read more >
How to Optimize Components to Improve React Performance
In this tutorial, you will learn how to maximize React performance by measuring rendering bottlenecks and optimizing your components.
Read more >
8 common React error messages and how to address them
This article will help you understand these details by going over some of the most common React error messages and explaining what they...
Read more >
5 Techniques for Optimizing Performance on a React App
For many applications, using React will lead to a fast user interface ... Doing this will fix the error, but it comes with...
Read more >
Optimizing React Components with Error Boundaries
By its original design, when JavaScript errors occur in a component as little as a Button component, it leads to the complete crash...
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