-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Is there a way to work with multiple entrypoints ? #13
Comments
Hello! FYI I have a project with pretty much the same setup and same issues (I did not try yet) |
Hi @shulard! You're right that this is not currently supported. No problem - let's figure out how! First, your setup has a different outputPath for each build, correct? So you are already able to generate multiple If so, then the issue is just with the bundle: I think there needs to be a way to define multiple "builds", each with a unique key and different config for the output dir. So, it might look like: webpack_encore:
# the "default" build
output_path: '%kernel.public_dir%/build'
builds:
frontend: '%kernel.public_dir%/frontend/build' Then in Twig: {{ encore_entry_script_tags('entry1', 'frontend') }}
{# or, really, it may need to be the third argument #}
{{ encore_entry_script_tags('entry1', null, 'frontend') }} The tricky part is that Thoughts? |
Hello @weaverryan ! Yep I already checked the second argument for I generate multiple entrypoints.json files so your solution seems the right one. It's also compatible with the asset logic. The only remaining questions : Is using the same logic for asset package and encore build a bit confusing for the users ? Is it relevant to support asset packages in encore twig helpers ? |
This option is necessary, after following this tutorial https://symfony.com/doc/current/frontend/encore/advanced-config.html#defining-multiple-webpack-configurations, I am left without being able to apply a different path for the front and admin
|
Yep it's exactly the case described here. @weaverryan, if you need any help to work on that code I'll be glad to give you some time 😄. |
Hey! Yes, this will get done MUCH faster if you can create a PR - it’s definitely a feature that makes sense. You can ping me on Slack if you want to discuss any part :) |
Hey there! Just wanted to say I ran into the same issue when trying to upgrade from encore 0.19 to 0.22. There are now new files (entrypoints.json in addition to manifest.json, runtime.js) I don't completely understand the purpose, and it looks that the Twig functions provided by the bundle are required to make things work, but it doesn't on multiple configuration. I think I'll rollback until this feature is supported. |
… each of them. (shulard) This PR was squashed before being merged into the master branch (closes #17). Discussion ---------- Allow to define multiple entrypoints and load assets from each of them. This PR is added to fix the issue #13. With that new code, you can configure your project like this : ```yaml webpack_encore: # the "default" build output_path: '%kernel.public_dir%/build' builds: frontend: '%kernel.public_dir%/frontend/build' ``` Then in your Twig template : ```twig {{ encore_entry_script_tags('entry1', 'frontend') }} ``` Commits ------- 0f3134b Add test regarding EntrypointLookupCollection. a238fe7 Handle the new Entrypoint collection to render paths. 2c38514 Create a new exception when the Entrypoint is not defined. 59bbd29 Update extension to load entrypoint build path. 0f69516 Add an EntrypointLookupCollection. ebe61d9 Allow to define a list of entrypoints to be used in the project.
Hello, is there anything new? |
The PR was merged (cf #17) but there is no official release for the moment. |
Hello, @shulard How did you deal with static files like (images, videos) in multiple layouts? Documentation says that we need to use Maybe it would be a good idea to add something like Also it would be helpful to add something like |
Hello @berrymore ! You are right, it's not currently possible to retrieve files which are not CSS or JS. Using the I haven't used static files inside a webpack entrypoint for the moment, maybe you can open a new issue with a JSON sample ? We'll be able to implement something based on that 😄. |
Hello !
I just tried to install this new bundle coupled with the webpack-encore v0.21.0 and faced a little issue.
In my project we have multiple Encore configuration which export assets in multiple output path. Maybe it's not the recommended way to use it but with that setup I can't use the new features because every call to twig functions will read the entry point defined in the output path.
Before that, we used the asset package feature to declare multiple packages (each one with it's own manifest.json file).
I checked the Bundle code and find that the asset packages are still used but the entrypoint.json file is always the same.
Is there a way to handle that case ?
The text was updated successfully, but these errors were encountered: