Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/pdf_preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import PropTypes from 'prop-types';
import React from 'react';
import PDFJS from 'pdfjs-dist';
import debounce from 'lodash/debounce';

import {getFileDownloadUrl} from 'mattermost-redux/utils/file_utils';
Expand Down Expand Up @@ -147,7 +146,10 @@ export default class PDFPreview extends React.PureComponent {
}

getPdfDocument = () => {
PDFJS.getDocument(this.props.fileUrl).then(this.onDocumentLoad).catch(this.onDocumentLoadError);
import('pdfjs-dist').then((PDFJS) => {
Comment thread
jespino marked this conversation as resolved.
PDFJS.disableWorker = true;
PDFJS.getDocument(this.props.fileUrl).then(this.onDocumentLoad).catch(this.onDocumentLoadError);
});
}

onDocumentLoad = (pdf) => {
Expand Down
1 change: 0 additions & 1 deletion plugins/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ window.ReactRedux = require('react-redux');
window.ReactBootstrap = require('react-bootstrap');
window.ReactRouterDom = require('react-router-dom');
window.PropTypes = require('prop-types');
window.PDFJS = require('pdfjs-dist');
window.Luxon = require('luxon');

// Functions exposed on window for plugins to use.
Expand Down
4 changes: 0 additions & 4 deletions root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import './entry.js';
import React from 'react';
import ReactDOM from 'react-dom';

import PDFJS from 'pdfjs-dist';

import {logError} from 'mattermost-redux/actions/errors';

// Import our styles
Expand All @@ -20,8 +18,6 @@ import {isDevMode, setCSRFFromCookie} from 'utils/utils';
import store from 'stores/redux_store.jsx';
import App from 'components/app';

PDFJS.disableWorker = true;

// This is for anything that needs to be done for ALL react components.
// This runs before we start to render anything.
function preRenderSetup(callwhendone) {
Expand Down