nanogallery2 icon indicating copy to clipboard operation
nanogallery2 copied to clipboard

nanogallery not working with Webpack babel-loader any more

Open boulepick opened this issue 4 years ago • 5 comments

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

boulepick avatar May 16 '20 18:05 boulepick

@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.

Kris-B avatar Jun 16 '20 19:06 Kris-B

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.

boulepick avatar Jun 19 '20 13:06 boulepick

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

Kris-B avatar Jan 12 '21 10:01 Kris-B

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

boulepick avatar Jan 12 '21 16:01 boulepick

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.

Kris-B avatar Jan 14 '21 22:01 Kris-B