Merge pull request #8087 from yurydelendik/pdf_viewer_req
Allows to pull pdf.js from pdf_viewer using require().
This commit is contained in:
commit
d0d9843a0e
13
web/pdfjs.js
13
web/pdfjs.js
@ -12,13 +12,22 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* globals module */
|
/* globals module, __pdfjsdev_webpack__ */
|
||||||
/* umdutils ignore */
|
/* umdutils ignore */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {
|
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 {
|
} else {
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user