It is recommended to stop supporting Internet Explorer 11 because it will not be supported by Microsoft on June 15, 2022
In order to support Internet Explorer (IE) 11, add the following polyfills to the entry point of your React application (`index.html`
):
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
For pdf.js v2.6.347
The default build of `pdfjs-dist`
v2.6.347 doesn't support IE 11. So if you are using this version of `pdfjs-dist`
,
you have to follow more steps:
- Point
`pdfjs-dist`
to its ES5 build
Assume that you're using Webpack to bundle the application, then set `pdfjs-dist`
in the `alias`
key:
const path = require('path');
module.exports = {
entry: '...',
output: {
...
},
module: {
...
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
alias: {
'pdfjs-dist': path.resolve('./node_modules/pdfjs-dist/es5/build/pdf.js'),
},
},
};
- Set the worker path:
import { Worker } from '@react-pdf-viewer/core';
<Worker workerUrl='https://unpkg.com/pdfjs-dist@2.6.347/es5/build/pdf.worker.js'>