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

Bundling does not work in multi module #244

Closed
gbourant opened this issue Jun 29, 2024 · 3 comments
Closed

Bundling does not work in multi module #244

gbourant opened this issue Jun 29, 2024 · 3 comments

Comments

@gbourant
Copy link

I have the following multi module project https://github.com/gbourant/multi-bundler-bug

It consists of project-a and project-b.

project-a works as expected. the main.js gets bundled.

project-b has a dependency to project-a. if you try to run project-b you get the following error:

ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkiverse.web.bundler.deployment.DevModeBundlingProcessor#watch threw an exception: io.mvnpm.esbuild.BundleException: Error during bundling: 

✘ [ERROR] Could not resolve "htmx.org/dist/htmx.esm.js"
    app/main.js:3:17:
      3 │ import htmx from 'htmx.org/dist/htmx.esm.js';
        ╵                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 You can mark the path "htmx.org/dist/htmx.esm.js" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

1 error
[watch] build finished, watching for changes...
	at io.mvnpm.esbuild.Execute$Streamer.lambda$run$0(Execute.java:150)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	... 1 more

@ia3andy
Copy link
Contributor

ia3andy commented Jun 29, 2024

You shouldn't use web-dependency-locator and the web-bundler together, they serve the same goal.

You can use:

quarkus.web-bundler.dependencies.auto-import=all

then you don't need the app.js

If you wish to keep the app.js, just do import 'htmx.org';, it should be enough to use it.

To make the second module work you should add the dependency for htmx again since it's provided (non transitive)

@gbourant
Copy link
Author

Alright, i removed the web-dependency-locator.

Since the version 2.0.0 of htmx, the htmx library is not available at the windows object see bigskysoftware/htmx#2628 (comment)

So in my case quarkus.web-bundler.dependencies.auto-import=all and import 'htmx.org'; is not useful.

Well, when i added the htmx to second's module pom.xml it worked but that doesn't make it work out of the box.

Instead, when i used quarkus.web-bundler.dependencies.compile-only=false (in project-a), it made it work out of the box. (but that made the target directory little bigger)

I don't know which option i will use at the end, but at least now i got 2 options that make it work.

@ia3andy
Copy link
Contributor

ia3andy commented Jun 29, 2024

You still have this workaround: #84 (comment)

@ia3andy ia3andy closed this as completed Jul 18, 2024
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

2 participants