Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack + Prepack + React, not optimizing react elements #53

Open
natew opened this issue Nov 18, 2018 · 1 comment
Open

Webpack + Prepack + React, not optimizing react elements #53

natew opened this issue Nov 18, 2018 · 1 comment
Labels

Comments

@natew
Copy link

natew commented Nov 18, 2018

Expected Behavior

Attempting to get this to prepack react elements: https://github.com/facebook/prepack/wiki/react-compiler

Actual Behavior

Components don't seem to be picked up, neither do __evaluatePureFunction tagged functions. I do see prepack working on other areas.

Specifications

  • Platform: Mac
  • Plugin version: 1.1.2
  • Webpack version: 4.25.1

Here's some example code output when running it:


      const CosalDebug = __evaluatePureFunction(() => {
        return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
          style: {
            height: '100%',
            overflow: 'hidden',
            position: 'relative'
          }
        }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](Half, null, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Saliency__WEBPACK_IMPORTED_MODULE_2__[
        /* Saliency */
        "a"], null)), react__WEBPACK_IMPORTED_MODULE_0__["createElement"](Half, {
          style: {
            flex: 4
          }
        }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Search__WEBPACK_IMPORTED_MODULE_1__[
        /* Search */
        "a"], null)));
      }); // prepack


      if (global.__optimizeReactComponentTree) {
        __optimizeReactComponentTree(CosalDebug);
      }

As you can see the function doesn't seem to be touched by prepack, but I'm attempting to run it with these options:

new PrepackPlugin({
        reactEnabled: true,
        compatibility: 'node-react',
})
@websocket98765
Copy link

Still seeing this issue. I built a demo that shows the problem that uses an up-to-date, barebones Create React App + react-app-rewired to include this plugin.

Is it certain this is an issue with prepack-webpack-plugin or should it be reported on the facebook/prepack repo?

Would really like to use this.

@gajus gajus added the question label Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants