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

t.resolve is not a function #13

Open
dylanvdmerwe opened this issue Sep 7, 2018 · 3 comments
Open

t.resolve is not a function #13

dylanvdmerwe opened this issue Sep 7, 2018 · 3 comments

Comments

@dylanvdmerwe
Copy link

dylanvdmerwe commented Sep 7, 2018

I am trying to test the component in an ionic v3 app by following these instructions to set things up.

However I have the following error when opening a page with the hive-pdf-viewer on it.

TypeError: t.resolve is not a function
    at Object.setNativePromise (polyfills.js:3)
    at L.configurable.L.set (polyfills.js:3)
    at module.exports (hive-pdf-viewer.js:79796)
    at $export (hive-pdf-viewer.js:79858)
    at hive-pdf-viewer.js:80943 "http://localhost:8100/build/pdfviewer/hive-pdf-viewer.js"

image

The www directory looks like this with the pdfviewer files:
image

System info:

 @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.11.3
    npm  : 6.3.0
    OS   : Windows 10
@sean-perkins
Copy link
Contributor

Since this package relies on copying the worker from PDF.js, you cannot use the regular implementation for web components. Please follow the README:

angular.json

{
    "glob": "**/*",
    "input": "node_modules/@teamhive/stencil-pdf-viewer/dist/pdfviewer",
    "output": "./pdfviewer"
}

main.ts (or app.module.ts)

import '@teamhive/stencil-pdf-viewer/dist/pdfviewer';

@ghgithub
Copy link

ghgithub commented Dec 7, 2018

I'm having the same issue.
image
my package.json info:
image

@dfa1234
Copy link

dfa1234 commented Jul 25, 2019

Ok I found the solution.
That is a pretty weird/magical one.
First, you need to remove node_modules and package-lock.json
Than you need to install any version of pdf.js-dist, but older than 2.1.
Like
npm i pdfjs-dist@2.0.943
Even if in your package module you have apparently the good version.
Working with the same configuration of the above package.json

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

4 participants