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

bug: bundled code is missing definitions for "import as" functions #8285

Closed
alexanderGalushka opened this issue Nov 7, 2020 · 6 comments · Fixed by #8901
Closed

bug: bundled code is missing definitions for "import as" functions #8285

alexanderGalushka opened this issue Nov 7, 2020 · 6 comments · Fixed by #8901
Assignees
Labels
cli related to cli/ dir needs investigation requires further investigation before determining if it is an issue or not swc related to swc (bundling/transpiling)

Comments

@alexanderGalushka
Copy link

deno --version

deno 1.5.0
v8 8.7.220.3
typescript 4.0.3

deno bundle "https://deno.land/x/[email protected]/mod.ts" > djwt.js

using the bundled djwt.js produces the following error:

ReferenceError: convertUint8ArrayToHex is not defined

convertUint8ArrayToHex is declared in deps.ts of the djwt lib

referencing an issue opened against djwt

@kitsonk kitsonk added bug Something isn't working correctly cli related to cli/ dir upstream Changes in upstream are required to solve these issues labels Nov 8, 2020
@kitsonk kitsonk self-assigned this Nov 8, 2020
@kitsonk kitsonk added needs info needs further information to be properly triaged and removed bug Something isn't working correctly labels Nov 8, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Nov 8, 2020

While convertUint8ArrayToHex is declared in _depts.ts it is not imported and subsequently exported from mod.ts, so the bundling appears to be working as designed.

The only exported symbols from mod.ts are create, decode, getNumericDate, and verify and if I run the bundle with a simply:

import * as djwt from "./djwt.js";
console.log(djwt);

I get no errors, and exactly the same symbols logged if I use the module directly.

@kitsonk kitsonk removed the upstream Changes in upstream are required to solve these issues label Nov 8, 2020
@alexanderGalushka
Copy link
Author

@kitsonk thank you for looking into this, I've put together a quick test,
see reamde to reproduce reported issue

it comes down to
https://github.com/timonson/djwt/blob/master/mod.ts#L97 ->
https://github.com/timonson/djwt/blob/master/mod.ts#L1 ->
https://github.com/timonson/djwt/blob/master/_depts.ts#L4

convertUint8ArrayToHex is the second import as in _depts.ts

@quaos
Copy link

quaos commented Nov 12, 2020

I also encountered this with _reactDevelopmentDewDew is not defined

@kitsonk kitsonk added needs investigation requires further investigation before determining if it is an issue or not swc related to swc (bundling/transpiling) and removed needs info needs further information to be properly triaged labels Nov 17, 2020
@burkeholland
Copy link

Ran into this with Handlebars for Deno...

alosaur/handlebars#8

@lucacasonato
Copy link
Member

@alexanderGalushka Can you check if this is still present in 1.5.4? I think this is a duplicate of #8314, which is fixed.

@kdy1
Copy link

kdy1 commented Dec 27, 2020

This is fixed by new version of swc_bundler. (I've added test for it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir needs investigation requires further investigation before determining if it is an issue or not swc related to swc (bundling/transpiling)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants