nanogallery2
nanogallery2 copied to clipboard
nanogallery not working with Webpack babel-loader any more
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 = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', '
': '`', '=': '=' };`
to
var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": **'''**, '/': '/', '
': '`', '=': '=' };`
so changing ''' to '''
is causing an error with webpack.
Cheers
@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, '''
still present.
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 Did you try to get some help from the Babel issue tracker (https://github.com/babel/babel/issues) ?
no i have not opened the issue with Babel issue tracker, figured that would be coming from you as the owner of this library.
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.