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

Question on special character & with Angular build #223

Open
bayy opened this issue Jan 14, 2018 · 2 comments
Open

Question on special character & with Angular build #223

bayy opened this issue Jan 14, 2018 · 2 comments

Comments

@bayy
Copy link

bayy commented Jan 14, 2018

I am using xml2js, which uses sax-js, to save and load a xml file to a server with Angular 5. I encountered a problem with char & in an angular production environment only.

I have a text field with value 'a & b', which is saved to the server as a & b using xml2js. When loading the data from the server, it works on a local environment. However, on a production server, it will complain that "Cannot read property 'toLowerCase' of undefined" with the following code.

this.parser.parseString(xmlSource, (err, result) => {
      allNodes = this.parseXML(result.x);
});

The err in the above code shows stack trace of minified code.

    TypeError: Cannot read property 'toLowerCase' of undefined
    at L (sax.js:913)
    at o.write (sax.js:1485)
    at h.parseString (parser.js:322)
    at h.parseString (parser.js:5)
    at e.fromXML (xml.service.ts:52)

line 912 of sax.js shows parser.entity returns null, though on local environment, it is 'amp'
screen shot 2018-01-12 at 4 33 58 pm

Any help will be greatly appreciated.

@bayy
Copy link
Author

bayy commented Jan 15, 2018

This turned out to be a bug in UglifyJS mishoo/UglifyJS#2783. It has been fixed.

@vdechef
Copy link

vdechef commented Jan 21, 2018

Thanks ! This helped me a lot.
I had a problem with a Vue application that uses xlsx-populate.
Webpack build was running without errors, but at runtime I had a ReferenceError in sax.
Forcing uglifyjs-webpack-plugin to use the latest version of uglify-es solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants