Skip to content

Commit

Permalink
Merge pull request mozilla#8087 from yurydelendik/pdf_viewer_req
Browse files Browse the repository at this point in the history
Allows to pull pdf.js from pdf_viewer using require().
  • Loading branch information
yurydelendik authored Mar 1, 2017
2 parents 0d52181 + d6de070 commit 8b54c3b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/pdfjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals module */
/* globals module, __pdfjsdev_webpack__ */
/* umdutils ignore */

'use strict';

if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {
module.exports = window['pdfjs-dist/build/pdf']; // loaded via html script tag
var pdfjsLib;
// The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
if (typeof __pdfjsdev_webpack__ === 'undefined') {
if (typeof require === 'function') {
pdfjsLib = require('../build/pdf.js'); // using a bundler to pull the core
} else {
pdfjsLib = window['pdfjs-dist/build/pdf']; // loaded via html script tag
}
}
module.exports = pdfjsLib;
} else {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down

0 comments on commit 8b54c3b

Please sign in to comment.