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

Uncaught ReferenceError when running bundle created with Deno 1.5.x #8399

Closed
Nitive opened this issue Nov 16, 2020 · 5 comments
Closed

Uncaught ReferenceError when running bundle created with Deno 1.5.x #8399

Nitive opened this issue Nov 16, 2020 · 5 comments
Labels
bug Something isn't working swc related to swc (bundling/transpiling)

Comments

@Nitive
Copy link

Nitive commented Nov 16, 2020

Hello! I'm experiencing the same issue as #8211, but with encoding/yaml module from standard library

index.ts

import * as yaml from "https://deno.land/std@0.78.0/encoding/yaml.ts"
console.log(yaml && 1)

Dockerfile

FROM hayd/deno:alpine-1.5.2 AS build

WORKDIR /app

COPY index.ts ./

# no error
RUN deno run index.ts

RUN deno bundle ./index.ts index.js

# error: Uncaught ReferenceError: isBoolean is not defined
RUN deno run ./index.js

If I use hayd/deno:alpine-1.4.6 as base image, everything works file

@Nitive
Copy link
Author

Nitive commented Nov 16, 2020

Same problem with deno@1.5.3

$ deno --version
deno 1.5.3 (ab7b8ba, release, x86_64-apple-darwin)
v8 8.7.220.3
typescript 4.0.5

$ deno bundle index.ts index.js
Bundle file:///Users/nitive/Work/csssr-infrastructure/deno/tools/test/index.ts
Check file:///Users/nitive/Work/csssr-infrastructure/deno/tools/test/index.ts
Emit "index.js" (91.53KB)

$ deno run index.js
error: Uncaught ReferenceError: isBoolean is not defined
    predicate: isBoolean,
               ^
    at file:///Users/nitive/Work/csssr-infrastructure/deno/tools/test/index.js:136:16

@MarkTiedemann
Copy link
Contributor

I'm hitting a similar error when bundling a specific import rather than *.

import { stringify } from "https://deno.land/std@0.78.0/encoding/yaml.ts";
console.log(stringify({ a: 1 }));
> deno run index.js
error: Uncaught ReferenceError: Cannot access 'failsafe' before initialization
        failsafe
        ^
    at file:///C:/dev/test/index.js:2289:9

@kitsonk kitsonk added bug Something isn't working cli related to cli/ dir upstream Changes in upstream are required to solve these issues labels Nov 16, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Nov 16, 2020

cc/ @kdy1

@kitsonk kitsonk added swc related to swc (bundling/transpiling) and removed upstream Changes in upstream are required to solve these issues cli related to cli/ dir labels Nov 17, 2020
kdy1 added a commit to kdy1/swc that referenced this issue Nov 19, 2020
kdy1 added a commit to swc-project/swc that referenced this issue Nov 19, 2020
swc_bundler:
 - Bundler rework. (denoland/deno#6802)
 - Reexports are not transitive. (denoland/deno#8246)
 - Dependencies of module with circular dependency. (denoland/deno#8302)
 - Order of injection between import vs export. (denoland/deno#8302)
 - `export *` in wrapped modules. (denoland/deno#8308, denoland/deno#8399)
 - `export { a as b }` in wrapped modules.
 - Fix denoland/deno#8314.
 - Fix denoland/deno#8325.
 - Fix denoland/deno#8344.
 - Make deno test verify exported names. 
 - Handle `export * from './foo'`.

swc_ecma_parser:
 - Don't panic on private name in interface (Closes #1211)

swc_ecma_transforms:
 -  dce: Prevent infinite loop
 -  Faster constant propagation pass.
@bartlomieju
Copy link
Member

Fixed in #8443

@Nitive
Copy link
Author

Nitive commented Nov 24, 2020

Thank you! Everything is working on v1.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

4 participants