esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

v45 transpiling problem with the latest aleph.js on feat-0.3-beta branch

Open guiguan opened this issue 3 years ago • 6 comments

Hi, after upgrading to v45, my app got this error in browser with both SSR and non-SSR:

Error: The requested module '../../[email protected]/deno/prop-types.development.js' does not provide an export named 'any'
TypeError: The requested module '../../[email protected]/deno/prop-types.development.js' does not provide an export named 'any'
    at async Aleph.importModule (file:///Users/[redacted]/aleph.js/server/aleph.ts:905:12)
    at async Renderer.renderPage (file:///Users/[redacted]/aleph.js/server/renderer.ts:99:42)
    at async Aleph.#renderPage (file:///Users/[redacted]/aleph.js/server/aleph.ts:620:24)
    at async file:///Users/[redacted]/aleph.js/server/aleph.ts:613:14
    at async Renderer.cache (file:///Users/[redacted]/aleph.js/server/renderer.ts:76:24)
    at async Aleph.renderPage (file:///Users/[redacted]/aleph.js/server/aleph.ts:612:20)
    at async Server.handle (file:///Users/[redacted]/aleph.js/server/server.ts:254:30)
    at async file:///Users/[redacted]/aleph.js/server/server.ts:329:15

The app is using the latest aleph.js on feat-0.3-beta branch, which was working just fine with v43. However, your alephjs.org works fine with v45. Any idea what could be the cause?

guiguan avatar Aug 11 '21 12:08 guiguan

@guiguan try to clean the cache in deno info

ije avatar Aug 11 '21 15:08 ije

@ije after removing the cache in deno info, I got another error:

Uncaught Error: React Refresh runtime should not be included in the production bundle.
    at runtime.js:2
    at runtime.js:2
    at runtime.js:2
    at runtime.js:2
    at runtime.js:2

from this file https://esm.sh/v45/[email protected]/deno/runtime.js, and I was using dev mode:

ALEPH_DEV_PORT=8081 aleph dev -p 3031 -r -L debug

guiguan avatar Aug 12 '21 10:08 guiguan

I resolved the above error, now I am still getting the first error for v45 (latest master) even after cleaning all cahes. However, after reverting my esm.sh instance back to v43, everything works fine again.

guiguan avatar Aug 15 '21 12:08 guiguan

If I run alephjs.org locally against aleph.js, and both connect to v45, I got the same error

guiguan avatar Aug 15 '21 12:08 guiguan

@guiguan thanks,I will look into it

ije avatar Aug 15 '21 13:08 ije

I might have the same error (or as https://github.com/postui/esm.sh/issues/61), which I’m guessing is a wrong esbuild setting.

Take:

<!doctype html>
<script type="module">
  import {compile} from 'https://esm.sh/micromark';
  console.log(compile);
</script>

That should print some error in a browser (depends on which file it gets first). In the source files, such as parse.js or compile.js, (in v45/[email protected]/es2021/lib), you can see that each export as micromark: e.g., export{ln as micromark}; Looking at the code, each file does export something (e.g., https://github.com/micromark/micromark/blob/b866e34551cf3ad34250c58e92f322714ba9d8da/packages/micromark/dev/lib/parse.js#L21), but a named function, which is definitely not called micromark micromark itself is also using an export map: https://github.com/micromark/micromark/blob/b866e34551cf3ad34250c58e92f322714ba9d8da/packages/micromark/package.json#L54

wooorm avatar Aug 25 '21 14:08 wooorm