denoland/deno

deno bundle doesnt include code from pika

katywings opened this issue · 7 comments

IS:
As the title says the output of deno bundle when including something from pika.dev seems to ignore pika atleast partially.

I created a little test repo with a "bundle.sh" script: https://github.com/katywings/deno-pika-bundle-test

What I try to bundle looks something like this:

import { css } from 'https://cdn.pika.dev/otion@^0.3.1/runtime-deno'

css({ backgroundColor: 'black' })

The result bundle actually includes the code from "https://cdn.pika.dev/otion@^0.3.1/runtime-deno", but then the nested exports from the lines of runtime-deno are missing. So it looks like deno bundle is ignoring stuff like this:
export * from '/-/otion@v0.3.1-5j8xeqtzaBPg93oc5Bwe/dist=es2017,mode=exports/server-deno';

SHOULD:
deno bundle should include all imported dependencies from pika.

DETAILS:

  • Execution of deno bundle does not give any errors
  • My random guess would be that this could be related to #4542 because /-/otion@v0.3.1-5j8xeqtzaBPg93oc5Bwe/dist=es2017,mode=exports/server-deno also seems to be using the export X as Y syntax, but I am not sure

Probably the same issue as in #4542

This could be related to an issue I was having while attempting to import react from pika.

Actually this is a duplicate of #4539

@kitsonk / @bartlomieju Since Kitson mentioned that #4542 seems to be fixed, I tried my bundles out too. Sadly this issue still persists, therefore I guess it probably really has to do with #4539 and not #4542 ;).

A few more details:

Bundle using cli

When I run deno bundle --config tsconfig.json lib/client/bundle.tsx with a tsconfig of:

{
  "compilerOptions": {
    "lib": ["DOM", "ESNext"],
    "strict": false,
    "jsxFactory": "h",
    "noImplicitAny": false
  }
}

Source of bundle.tsx: https://github.com/nexojs/starter/blob/e793ab0e1edfcd1f1c7154c74dfb43c39823d597/lib/client/bundle.tsx

Then I get the following ouput: out.txt and it doesnt include the pika dependencies.

Bundle using Deno.bundle

When I try to bundle the same bundle.tsx file but with the Deno.bundle js api, then it doesn't bundle anything at all and I get the following error: error.txt

Bundle statement: https://github.com/nexojs/nexo/blob/0a0f9bd3cec79e703d00f86fb06b5f08be2a18db/mod.ts#L96

Yeah, your problem is #4539. Recent changes in v1.1.1 make this a bit easier to deal with, but it is still a rather complex issue.

This is working in the latest release.

import { css } from 'https://cdn.pika.dev/otion@^0.3.1/runtime-deno'

console.log(css({ backgroundColor: 'black' }))
/m/s/P/g/d/deno ❯❯❯ deno bundle tst.js | deno run --no-check -
Bundle file:///mnt/starship/Projects/github.com/denoland/deno/tst.js
_ayn9pq
/m/s/P/g/d/deno ❯❯❯ deno --version
deno 1.12.1 (release, x86_64-unknown-linux-gnu)
v8 9.2.230.14
typescript 4.3.5

@lucacasonato Whoaaa awesome! Ty for the update 🙂