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

Primitives is not defined with parcel 2 build command output #1915

Closed
andrewvmail opened this issue Jul 5, 2022 · 7 comments · Fixed by #1891
Closed

Primitives is not defined with parcel 2 build command output #1915

andrewvmail opened this issue Jul 5, 2022 · 7 comments · Fixed by #1891

Comments

@andrewvmail
Copy link

Using @react-pdf/renderer 2.3.0" and latest parcel 2, production build, builds fine but opening the app you will see
image

The reference error leads to primitives in the source map.

Minimal reproduction
https://github.com/andrewvmail/parcel-react-pdf-bug-demo

git clone https://github.com/andrewvmail/parcel-react-pdf-bug-demo
cd parcel-react-pdf-bug-demo
yarn
parcel build src/index.html
cd dist
npx http-server 
# open localhost:8080

# another terminal
parcel serve src/index.html
# no console error

Thanks in advance!

@jeetiss
Copy link
Collaborator

jeetiss commented Jul 6, 2022

I can not reproduce the problem, it's working!

Which version of parcel do you use?

Снимок экрана 2022-07-06 в 12 02 37

@carlobeltrame
Copy link
Contributor

Sounds like a duplicate of #1317. The issues with ESM compatibility are deeper than just the default exports. @andrewvmail please join us at #1891 where we attempt to fix the browser and ESM compatibility, and discuss how the library will further develop in order to become isomorphic. It would help out greatly if you could test #1891 using parcel!

@andrewvmail
Copy link
Author

I can not reproduce the problem, it's working!

Which version of parcel do you use?

Снимок экрана 2022-07-06 в 12 02 37

parcel 2 latest as of yesterday

I can not reproduce the problem, it's working!

Which version of parcel do you use?

Снимок экрана 2022-07-06 в 12 02 37

I'm using parcel 2.5 globally installed, did you do parcel build or parcel serve? parcel serve works fine.
Have to clean it again and retry if you used parcel serve once.

rm -rf .parcel-cache
rm -rf dist
parcel build src/index.html
cd dist; npx http-server 

@andrewvmail
Copy link
Author

Just tried again using parcel 2.6.2. Parcel build still produces error. Identical problem to this one too #1786

@tarabishy2020
Copy link

"parcel": "^2.6.2",
"@react-pdf/renderer": "^2.3.0",
and getting similar error pointing to the last line

ReferenceError: $d3857507522fe20e$import$5ace8e5c686fb130 is not defined
var $d3857507522fe20e$export$2e2bcd8739ae039 = {
    pdf: $d3857507522fe20e$export$278e8ca9e1fa9094,
    Font: $d3857507522fe20e$export$89abf52a030e56ee,
    version: $d3857507522fe20e$export$83d89fbfd8236492,
    StyleSheet: $d3857507522fe20e$export$9d753cd7ae895cce,
    usePDF: $d3857507522fe20e$export$398b9fbd663a6614,
    PDFViewer: $d3857507522fe20e$export$e86b8823e5baa9d,
    BlobProvider: $d3857507522fe20e$export$5fb2f8b440914d36,
    PDFDownloadLink: $d3857507522fe20e$export$3b449de3ec3c756d,
    renderToStream: $d3857507522fe20e$export$97f86213fef5749d,
    renderToString: $d3857507522fe20e$export$80e7718417253a51,
    renderToFile: $d3857507522fe20e$export$138b5c407a9e1fda,
    render: $d3857507522fe20e$export$b3890eb0ae9dca99,
    //->>// ...$d3857507522fe20e$import$5ace8e5c686fb130
};

@andrewvmail
Copy link
Author

andrewvmail commented Jul 8, 2022

Here is a hot fix until parcel gets updated. https://gist.github.com/andrewvmail/a94a5a3671a8f58300c3163d07042686
Will close when this is released parcel-bundler/parcel#7991 and it fixes this.

@yoonwaiyan
Copy link

Is this fixed? I'm seeing the same error here in my project. My react version is 16.14.0, using Parcel 2.12.0, nodejs 16.20.2.

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

Successfully merging a pull request may close this issue.

5 participants