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

nanogallery not working with Webpack babel-loader any more #260

Open
boulepick opened this issue May 16, 2020 · 5 comments
Open

nanogallery not working with Webpack babel-loader any more #260

boulepick opened this issue May 16, 2020 · 5 comments
Labels

Comments

@boulepick
Copy link

Environment
"nanogallery2": "^2.4.2",
"@babel/core": "^7.4.3",
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"babel-loader": "^8.0.5",
"babel-plugin-module-resolver": "^3.2.0",

Describe the bug
Was able to compile find on the previous version of nanogallery, updated to the latest version and getting an error when running webpack with babel-loader.

ERROR in ./js/vendor/jquery.nanogallery2.core.js
Module build failed (from ../node_modules/babel-loader/lib/index.js):
SyntaxError: H:\src\js\vendor\jquery.nanogallery2.core.js: Unexpected token, expected "," (659:88)

657 | // function to avoid XSS issue - Cross Site Scripting
658 | // original: https://github.com/janl/mustache.js/blob/master/mustache.js#L55

659 | var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', '`': '`', '=': '=' };
| ^
660 | function escapeHtml (instance, string) {

..........

turns out a minor change in the entityMap variable is causing the issue.

it changed from

var entityMap = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '': '`', '=': '=' };`

to

var entityMap = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": **'''**, '/': '&#x2F;', '': '`', '=': '=' };`

so changing '&#39;' to ''' is causing an error with webpack.

Cheers

@Kris-B
Copy link
Member

Kris-B commented Jun 16, 2020

@boulepick thanks for posting this issue.
However, I didn't change anything in the entityMap since numerous versions. I just downloaded release 2.4.2 from Github to check it: no change, '&#39;' still present.

@boulepick
Copy link
Author

ok, then it may have been a change from webpack that now is detecting ''' as an issue. anyway it is out there for anyone else having the same issue.

@Kris-B
Copy link
Member

Kris-B commented Jan 12, 2021

@boulepick Did you try to get some help from the Babel issue tracker (https://github.com/babel/babel/issues) ?

@boulepick
Copy link
Author

no i have not opened the issue with Babel issue tracker, figured that would be coming from you as the owner of this library.

@Kris-B
Copy link
Member

Kris-B commented Jan 14, 2021

Sorry but I have no experience with webpack babel-loader. I suggest you open an issue there, and I'll try to help find the origin of the issue.

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

2 participants