-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Can't esbuild multiple files unless I use unix find #424
Comments
It is probably possible to bundle multiple files by using the wildcard expansion feature of your shell such as
I don't understand why you would expect that giving esbuild some JavaScript files would generate a HTML file. If you are trying to pass esbuild a HTML file as an input and are expecting it to parse the HTML file for files to bundle, this is a future feature that will likely be added at some point but that doesn't currently exist. I am using issue #31 to track that feature request.
It looks like you are telling esbuild to bundle each file with |
Ah, I was under the impression that esbuild works like a webpack which creates a ready bundled website. How do I introduce esbuild to my existing project where I use webpack to generate a site under |
@c0debreaker I come from a webpack background myself and still don't know why you were you expecting an HTML file... In webpack your need to explicitly use an HTML plugin (like html-webpack-plugin) since webpack, like esbuild, is a bundler not a HTML generator. For esbuild it'll be easiest to write some kind of postbuild step either in NodeJS or Bash. Personally I have an index.html in src/ and |
I mentioned in last comment that I thought esbuild works the same as webpack and I was wrong. I can write a script to do that. I'm seeing filenames didn't get modified by esbuild. Looks like I can get a hash string of the final file in dist then inject that filename in index.html, then finally put it in dist. With that, I can stop using webpack. Correct? |
Apology, I'm still very confused with esbuild. The command I executed was
This is the new import o from"./rum";import r from"react";import e from"react-dom";import{Route as t,BrowserRouter as m}from"react-router-dom";import p from"./App";o.setInitialPageLoadName("BuildViewer Frontend"),e.render(r.createElement(m,null,r.createElement(t,{path:"/",component:p})),document.getElementById("root")); If I specify index.js in index.html like below, I feel like it's not going to work. It looks like I am missing steps.
|
What are you trying to do? I'm still not clear on what specifically you are trying to do (e.g. what are the steps). Are you trying to bundle |
I have an existing ReactJS project where I use Yesterday, I executed What I want to accomplish is to make a web application ready using esbuild and some other scripts that I will write. I tried serving |
Use Let esbuild walk your files and dependencies for you, don't use |
I've done that before and when I do that, I get the errors below. Is it because I am using
Below is the directory structure of
|
This comment has been minimized.
This comment has been minimized.
Similar to tsconfig.json in TS, you should be able to use jsconfig.json to specify esbuild/internal/bundler/bundler_tsconfig_test.go Lines 232 to 251 in b29f211
|
Just got home. I'll try it now. Thanks! |
Ah, I see. Yes this sounds like the issue. I'm not home at the moment so I don't have any solutions right now, but I can look at this later. |
@heyheyhellow, it failed
and using --tsconfig
|
Thanks a lot! 😊 |
Hi @evanw, were you able to figure it out? |
Did you try using baseUrl as shown in the test I linked above? Can post your exact jsconfig.json please.
Considering the tests pass and in the tests they do exactly what you're trying to do but as import from 'lib' I think that should work for you...
Oct 5, 2020, 7:34 PM by [email protected]:
…
Hi > @evanw <https://github.com/evanw>> , were you able to figure it out?
—
You are receiving this because you were mentioned.
Reply to this email directly, > view it on GitHub <#424 (comment)>> , or > unsubscribe <https://github.com/notifications/unsubscribe-auth/AKUMJTQBJN5MQHZPTGK6CHLSJJ64XANCNFSM4SCXWOPA>> .
|
Here it is @heyheyhello {
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"baseUrl": ".",
"paths": {
"components/*": [
"src/components/"
],
"common/*": [
"src/common/"
]
}
}
} and the command
|
Want to just try:
Since that worked in Evan's tests |
I got the same error when I used --jsconfig, https://i.imgur.com/jmrMIMe.png and if using --tsconfig, https://i.imgur.com/xeatlO2.png |
I'm not sure then. I don't think you need to specify |
Thanks a lot! I really hope we'll be able to figure this out. There's a lot of project at work that can benefit from this. It will save huge amount in build time. |
I finally got it to work even without specifying jsconfig.json by editing my source code from
to
We will have to edit hundreds of application git repositories that uses |
If it's a common prefix just find-and-replace "from 'src/"
Oct 5, 2020, 11:09 PM by [email protected]:
…
I finally got it to work even without specifying jsconfig.json by editing my source code from
import Loader from 'react-loadable';import LoadingSpinner from 'src/common/Spinner';const Loadable = (opts) => Loader({ loading: LoadingSpinner, delay: 150, ...opts });export default Loadable;
to
import Loader from 'react-loadable';import LoadingSpinner from 'common/Spinner';const Loadable = (opts) => Loader({ loading: LoadingSpinner, delay: 150, ...opts });export default Loadable;
We will have to edit hundreds of application git repositories that uses > .env> file. That's going to be very painful.
—
You are receiving this because you were mentioned.
Reply to this email directly, > view it on GitHub <#424 (comment)>> , or > unsubscribe <https://github.com/notifications/unsubscribe-auth/AKUMJTRGMLNPPIPTHLVUVATSJKYCRANCNFSM4SCXWOPA>> .
|
yep but tons of repositories that will have to edit. I'm going to clone esbuild and see if I can make changes to it and add a feature I need. |
@evanw @heyheyhello what parameter should I pass to fix this error?
|
Did you try searching the issues and reading the docs? This should work. |
I did search yesterday but didn't find it. Thanks a lot. I'll let you know. |
No more errors! Finally, esbuild completed successfully. However, I'm wondering where my png files are https://i.imgur.com/7Sz1ttE.png |
Have you tried inspecting the bundle? I imagine they're inlined like SVGs are...
Oct 6, 2020, 9:56 AM by [email protected]:
…
No more errors! Finally, esbuild completed successfully. However, I'm wondering where my png files are > https://i.imgur.com/7Sz1ttE.png
—
You are receiving this because you were mentioned.
Reply to this email directly, > view it on GitHub <#424 (comment)>> , or > unsubscribe <https://github.com/notifications/unsubscribe-auth/AKUMJTUIN3ZAVVF4VNS3MCTSJND4JANCNFSM4SCXWOPA>> .
|
I haven't but I tried serving the generated |
I also don't see index.html file in
dist
directory.The command I used was
I'm also wondering why I have to add
--external
since I wrote them.It's a ReactJS application.
The text was updated successfully, but these errors were encountered: