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

Bundle doesn't seem to have been generated - 404 #13

Closed
FallingSnow opened this issue Jan 11, 2021 · 16 comments
Closed

Bundle doesn't seem to have been generated - 404 #13

FallingSnow opened this issue Jan 11, 2021 · 16 comments

Comments

@FallingSnow
Copy link

INFO Download https://esm.sh/react • https://esm.sh/[react,react-hook-form,@fluentui/react,react-flow-renderer,swr]/react?target=es2018&dev
INFO Download https://cdn.esm.sh/bundle-ojv7uwoviwslf342bemex5fq7b4wvqk3.js 
error: Uncaught (in promise) Error: Download https://cdn.esm.sh/bundle-ojv7uwoviwslf342bemex5fq7b4wvqk3.js: Download https://cdn.esm.sh/bundle-ojv7uwoviwslf342bemex5fq7b4wvqk3.js: 404 - Not Found
                    throw new Error(`Download ${url}: ${err.message}`)

import_map.json

{
    "imports": {
        "https://esm.sh/": "https://esm.sh/[react,react-hook-form,@fluentui/react,react-flow-renderer,swr]/"
    }
}
@FallingSnow
Copy link
Author

Error when visiting https://cdn.esm.sh/bundle-ojv7uwoviwslf342bemex5fq7b4wvqk3.js:

/* esm.sh - error */
throw new Error("[esm.sh] " + "npm: package 'bundle-ojv7uwoviwslf342bemex5fq7b4wvqk3.js' not found");
export default null;
``

@ije
Copy link
Member

ije commented Jan 11, 2021

please try deno --reload run [...], i will fix this (new server deployment will clean up the old builds)

@FallingSnow
Copy link
Author

I'm using Aleph. What command would I run for that? I already tried

$ rm -rf .aleph
$ aleph dev
INFO Download https://esm.sh/graphql • https://esm.sh/[react,react-hook-form,@fluentui/react,react-flow-renderer,swr,graphql]/graphql?target=es2018&dev
INFO Download https://cdn.esm.sh/bundle-afim5jp55sr57xkzkzahvfk7mmkygh6l.js 
error: Uncaught (in promise) Error: Download https://cdn.esm.sh/bundle-afim5jp55sr57xkzkzahvfk7mmkygh6l.js: Download https://cdn.esm.sh/bundle-afim5jp55sr57xkzkzahvfk7mmkygh6l.js: 404 - Not Found

Made a slight change to import_map.json to work around the graphql issue (#14) right now. (Note the addition of graphql)

{
    "imports": {
        "https://esm.sh/": "https://esm.sh/[react,react-hook-form,@fluentui/react,react-flow-renderer,swr,graphql]/"
    }
}

@ije
Copy link
Member

ije commented Jan 12, 2021

i know what happened, i will fix it ASAP, thanks! please use package link instead of the bundle link, aleph v0.3 will bundle the code in production mode.

@ije
Copy link
Member

ije commented Jan 13, 2021

should work now:
https://esm.sh/[react,react-dom,swr]/react

@FallingSnow
Copy link
Author

Not sure if I'm using this right.

INFO Download https://esm.sh/tailwindcss/dist/tailwind.min.css • https://esm.sh/[react,react-hook-form,react-flow-renderer,swr]/tailwindcss/dist/tailwind.min.css?target=es2018&dev
error: Uncaught (in promise) Error: Download https://esm.sh/tailwindcss/dist/tailwind.min.css: Download https://esm.sh/tailwindcss/dist/tailwind.min.css: 500 - Internal Server Error
/* esm.sh - error */
throw new Error("[esm.sh] " + "npm: package '[react,react-hook-form,react-flow-renderer,swr]' not found");
export default null;

@shadowtime2000
Copy link

@FallingSnow CAn you share the imports?

@FallingSnow
Copy link
Author

import_map.json

{
    "imports": {
        "https://esm.sh/": "https://esm.sh/[react,react-hook-form,react-flow-renderer,swr]/"
    }
}

@shadowtime2000
Copy link

@FallingSnow You have to change that to [react,react-hook-form,react-flow-renderer,swc,tailwindcss] because the import to tailwind is being prefixed with that bundle which makes it invalid cuz tailwind isn't included in it.

@FallingSnow
Copy link
Author

Is there a way I could make a bundle for react related modules and no bundles for the others?

@shadowtime2000
Copy link

@FallingSnow

{
    "imports": {
        "react": "https://esm.sh/[react,react-hook-form,react-flow-renderer,swr]/"
    }
}

Then you just do

import "react/swr";

or whatever you want.

@FallingSnow
Copy link
Author

Hmmm, now I'm running into this:

$ aleph dev -L debug
DEBUG compile '/app.tsx' in 66ms
error: Uncaught (in promise) NotFound: No such file or directory (os error 2)
    at processResponse (deno:core/core.js:223:11)
    at Object.jsonOpAsync (deno:core/core.js:240:12)
    at async open (deno:runtime/js/30_files.js:44:17)
    at async Object.readFile (deno:runtime/js/40_read_file.js:15:18)
    at async Project._compile (project.ts:1019:29)
    at async Project._compile (project.ts:1169:28)
    at async Project._init (project.ts:655:21)
    at async project.ts:106:13
    at async start (server.ts:12:5)

Not sure what's causing it.

@FallingSnow
Copy link
Author

I modified the aleph source to see which file it was trying to read in project.ts. @shadowtime2000 Am I doing something wrong or is the module resolution not working as expected?

$ aleph dev -L debug
{ filepath: "/home/ayrton/Coding/node/mmes/server/app.tsx" }
DEBUG compile '/app.tsx' in 65ms
{ filepath: "/home/ayrton/Coding/node/mmes/server/style/index.less" }
{ filepath: "/home/ayrton/Coding/node/mmes/server/react/react" }
error: Uncaught (in promise) NotFound: No such file or directory (os error 2)
    at processResponse (deno:core/core.js:223:11)
    at Object.jsonOpAsync (deno:core/core.js:240:12)
    at async open (deno:runtime/js/30_files.js:44:17)
    at async Object.readFile (deno:runtime/js/40_read_file.js:15:18)
    at async Project._compile (project.ts:1023:29)
    at async Project._compile (project.ts:1173:28)
    at async Project._init (project.ts:658:21)
    at async project.ts:106:13
    at async start (server.ts:12:5)

app.tsx

import React, { ComponentType } from "react/react";

import_map.json

{
    "imports": {
        "react": "https://esm.sh/[react,react-hook-form,react-flow-renderer,swr,@fluentui/react,@uifabric/icons]/"
    }
}

@FallingSnow
Copy link
Author

@ije
Copy link
Member

ije commented Jan 13, 2021

i think using esm.sh's bundle mode in alephjs is not a good idea since the alephjs will handle the react import URL. and 0.3 will bundle the app in production mode.

@FallingSnow
Copy link
Author

FallingSnow commented Jan 13, 2021

Oh ok, I forgot you already said this and just kept charging forward, oops. I was trying to use it to avoid using ?external=react on everything.

I did get it pretty close to working, it actually imports now.

app.tsx

import React, { ComponentType } from "https://esm.sh/react/react";

import_map.json

{
    "imports": {
        "https://esm.sh/react/": "https://esm.sh/[react,react-hook-form,react-flow-renderer,swr,@fluentui/react,@uifabric/icons]/"
    }
}

EDIT: Accidentally submitted comment.

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

No branches or pull requests

3 participants