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

IE11 Syntaxerror #405

Closed
c2ofh opened this issue Nov 6, 2018 · 10 comments
Closed

IE11 Syntaxerror #405

c2ofh opened this issue Nov 6, 2018 · 10 comments

Comments

@c2ofh
Copy link

c2ofh commented Nov 6, 2018

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
I've included "signature_pad": "^3.0.0-beta.3" in angular6 via package.json
It's working well in all Browsers, but on IE11 the website can not be loaded due to an error.

image

"Syntaxerror" without any description what's wrong.

@szimek
Copy link
Owner

szimek commented Nov 6, 2018

I have no idea how Angular 6 build process looks, but you should compile it using the same Babel config that you use to compile your own code.

You can also use webpack resolve.alias feature (not tested), which should allow you to load the already compiled version instead:

module.exports = {
  //...
  resolve: {
    alias: {
      signature_pad: 'signature_pad/dist/signature_pad.js'
    }
  }
};

@c2ofh
Copy link
Author

c2ofh commented Nov 6, 2018

Thank you for your quick response.
I will give it a try. I will also try a babel polyfill if your idea isn't working. I never used it before.

@mkmule
Copy link

mkmule commented Dec 20, 2018

Try to import in this way:
change from:
import SignaturePad from 'signature_pad';
to:
import * as SignaturePad from 'signature_pad/dist/signature_pad';

@riswar
Copy link

riswar commented Feb 12, 2019

function download(dataURL, filename) {
if (navigator.userAgent.indexOf("Safari") > -1 && navigator.userAgent.indexOf("Chrome") === -1) {
window.open(dataURL);
}
### //Add below statement on app.js - it works as other two are not supported on IE 11
else if(window.navigator && window.navigator.msSaveOrOpenBlob){
var blobwin = dataURLToBlob(dataURL);
window.navigator.msSaveOrOpenBlob(blobwin, filename);
}

else {
var blob = dataURLToBlob(dataURL);
var url = window.URL.createObjectURL(blob);

var a = document.createElement("a");
a.style = "display: none";
a.href = url;
a.download = filename;

document.body.appendChild(a);
a.click();

window.URL.revokeObjectURL(url);

}
}

@wachunga
Copy link

wachunga commented Apr 9, 2019

@sdqwerty's workaround worked for me. However, it's worth noting that webpack has a field called mainFields which defaults to ['browser', 'module', 'main']. These are in priority order, and signature_pad does not include a browser in package.json, so module gets picked up. This maps to the .m.js file, which includes ES6 syntax like class -- which IE11 does not support.

@szimek I recommend you update package.json to include a browser field as per npm's recommendations here:
https://docs.npmjs.com/files/package.json#browser

That should clear up these IE11 issues.

@gitge
Copy link

gitge commented Mar 18, 2020

This worked for me:

module.exports = {
  resolve: {
    alias: {
      'signature_pad': 'signature_pad/dist/signature_pad' // <- hier without '.js' at the end!
    }
  }
};

And with Laravel-Mix:

mix.webpackConfig({
    resolve: {
        alias: {
            'signature_pad': 'signature_pad/dist/signature_pad',
        }
    }
});

@HereChen
Copy link

I have no idea how Angular 6 build process looks, but you should compile it using the same Babel config that you use to compile your own code.

You can also use webpack resolve.alias feature (not tested), which should allow you to load the already compiled version instead:

module.exports = {
  //...
  resolve: {
    alias: {
      signature_pad: 'signature_pad/dist/signature_pad.js'
    }
  }
};

v3.0.0-beta.4 compiled version does not support IE11 because of class keyword.

@UziTech UziTech closed this as completed Jun 19, 2021
@nemchik
Copy link

nemchik commented Jun 19, 2021

Closed because fixed?

@UziTech
Copy link
Collaborator

UziTech commented Jun 19, 2021

Closed because ie11 is no longer supported

@nemchik
Copy link

nemchik commented Jun 19, 2021

For those who find this in the future, Babel is able to transpile this too resolve the issue.

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

9 participants