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

Minify Bundle Error in CRA2 #5250

Closed
SCasarotto opened this issue Oct 2, 2018 · 10 comments
Closed

Minify Bundle Error in CRA2 #5250

SCasarotto opened this issue Oct 2, 2018 · 10 comments

Comments

@SCasarotto
Copy link

SCasarotto commented Oct 2, 2018

Is this a bug report?

Yes. When trying to build I receive the following error:

Failed to compile.

Failed to minify the bundle. Error: static/js/1.7292b262.chunk.js from Terser

After looking into this more it seems to be due to this package I am using (https://github.com/selvagsz/react-power-select). At this time I don't know if this is something that should be resolved in CRA or in that package. Have posted there as well but I want to share here in the case this is caused by something in CRA.(selvagsz/react-power-select#51)

Did you try recovering your dependencies?

Yes

Yarn Version: 1.10.1

Which terms did you search for in User Guide?

Terminal Error links to:
"npm run build fails to minify"

Environment

System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Binaries:
Node: 10.10.0 - /usr/local/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 69.0.3497.100
Safari: 12.0
npmPackages:
@tippy.js/react: ^1.0.0 => 1.0.0
react: ^16.5.2 => 16.5.2
react-dom: ^16.5.2 => 16.5.2
react-scripts: 2.0.3 => 2.0.3
npmGlobalPackages:
create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

Steps to reproduce:

  1. npx create-react-app my-app
  2. cd my-app
  3. yarn add react-power-select
  4. in /src/App.js add import { PowerSelect } from 'react-power-select'
  5. yarn build

Expected Behavior

Build Success!

Actual Behavior

Failed to compile.

Reproducible Demo

See Steps Above. Blank project with that library in it.

@gaearon
Copy link
Contributor

gaearon commented Oct 2, 2018

Did this work with react-scripts@1.x?

@SCasarotto
Copy link
Author

Yep, was working before upgrading last night.

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

Example failing file: https://file-vibjneuykx.now.sh

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

Issue exists in Terser: terser/terser#120

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

@Timer Timer modified the milestones: 2.0.4, 2.0.x Oct 3, 2018
@kzc
Copy link

kzc commented Oct 3, 2018

The fix appears trivial, so I hope it's released soon

Unfortunately that's not the case. I reworded the comment to remove confusion: terser/terser#120 (comment)

Use inline=2 until this issue is addressed.

Alternatively, someone can ask the Tether project to alter their code slightly to avoid the Terser bug: terser/terser#120 (comment). This corresponds to line 10061 in https://file-vibjneuykx.now.sh/

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

What kind of potential bundle increase are we talking about, do you have any numbers?

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

Cross posting excellent repro case so we can add it to our E2E, allowing us to safely opt back into default inline value instead of 2 (assuming we make this change).

function foo(node) {
    var traverse = function(obj) {
        var i = obj.data;
        return i && i.a != i.b;
    };
    while (traverse(node)) { }
}   

terser/terser#120 (comment)

@Timer Timer modified the milestones: 2.0.x, 2.0.4 Oct 3, 2018
@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

This fix is out in 2.0.4! Please upgrade and test.

@SCasarotto
Copy link
Author

Appears to work great! Really appreciate the help!

@lock lock bot locked and limited conversation to collaborators Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants