Create-react-app: String is modified in the production build

Created on 1 Mar 2018  Â·  7Comments  Â·  Source: facebook/create-react-app

Is this a bug report?

Yes.

Did you try recovering your dependencies?

This is about a clean new project.

Environment

  1. node -v: 8.9.4
  2. npm -v: 5.6.0
  3. npm ls react-scripts: 1.1.1
  4. Operating system: macOS

Steps to reproduce

  1. create-react-app minification-test && cd minification-test
  2. Replace App.js with
import React, { Component } from 'react';

class App extends Component {
  render() {
    const test = `<Script></Script>`;

    return (
      <p>{test}</p>
    );
  }
}

export default App;
  1. npm run build
  2. serve -s build (npm install serve -g if needed)

Expected behavior

I expect to see <Script></Script> on the screen.

Actual behavior

I see <Script></script> – the second script is lowercase.

Reproducible demo

npm start:
ok

Build:
broken

bug underlying tools

Most helpful comment

This looks like an UglifyJS issue, it is reproducible in UglifyJS playground with following code:

const test = `<Script></Script>`;

and inline_script option enabled.

All 7 comments

This looks like an UglifyJS issue, it is reproducible in UglifyJS playground with following code:

const test = `<Script></Script>`;

and inline_script option enabled.

Could you please file this issue with Uglify and link back here? Thank you!

Same issue here. I'm using react-chartkick that requires charts.js Guess this is related
No charting library found for t Removing Uglify inside webpack.config.prod.js is temp workaround for me.

Should we disable inline_script for now? What are those implications?

Can you please try react-scripts@2 and see if it persists in the beta?

FYI: mishoo/UglifyJS2#2991

Looks like this was fixed in Uglify. It'll work its way in here eventually.

Thanks for the report!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Evan-GK picture Evan-GK  Â·  3Comments

oltsa picture oltsa  Â·  3Comments

ap13p picture ap13p  Â·  3Comments

dualcnhq picture dualcnhq  Â·  3Comments

stopachka picture stopachka  Â·  3Comments