-
-
Notifications
You must be signed in to change notification settings - Fork 200
problem with Multiple Webpack Configurations #477
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
Comments
I have find temporary solution by asset() in twig:
|
and other solution:
in this case I have correct outputs:
manifest.json
|
Hi @Alymbek, In your first post you were using the same output path in both configs. Two solutions to this issue:
|
Just an update related to the second solution since it looks like the Webpack Encore Bundle does in fact supports multiple builds: webpack_encore:
output_path: '%kernel.public_dir%/public/default_build'
builds:
foo: '%kernel.public_dir%/public/foo_build'
bar: '%kernel.public_dir%/public/bar_build' You can then specify them when calling Twig methods: {# Default entrypoints.json file #}
{{ encore_entry_script_tags('main') }}
{{ encore_entry_link_tags('main') }}
{# Using the entrypoints.json file located in ./public/foo_build #}
{{ encore_entry_script_tags('foo_entry', null, 'foo') }}
{{ encore_entry_link_tags('foo_entry', null, 'foo') }}
{# Using the entrypoints.json file located in ./public/bar_build #}
{{ encore_entry_script_tags('bar_entry', null, 'bar') }}
{{ encore_entry_link_tags('bar_entry', null, 'bar') }} Edit: doesn't seem that version has been tagged yet though |
I guess closed by this one |
Closing this since a new version of the WebpackEncoreBundle that supports multiple |
It took me some time to find symfony/webpack-encore#477 , so I guess it would be better to add it to the official documentation.
…bout multi encore-builds (zbrag) This PR was submitted for the 4.2 branch but it was merged into the 3.4 branch instead (closes #11177). Discussion ---------- Update advanced-config.rst to contain more information about multi encore-builds It took me some time to find symfony/webpack-encore#477 , so I guess it would be better to add it to the official documentation. Commits ------- 954b398 Update advanced-config.rst
This PR was submitted for the 4.2 branch but it was merged into the 3.4 branch instead (closes #11593). Discussion ---------- fix encore multiple configuration build paths This PR fix two things: - `%kernel.public_dir%` does not exists and `%kernel.project_dir%/public` is the correct path. - As mentioned here symfony/webpack-encore#477, the multiple config will overwrite the `entrypoint.js`. The solution is to use two build directories, but this needs two different paths in the `webpack.config.js`. Now someone can just copy&paste the code lines and it should work. Commits ------- 81f9491 fix encore multiple configuration build paths
Isn't it possible to use multiple configs and merge entrypoints and manifests into one file entrypoins.js and manifest.js in default path? We have really HUGE application (biggest newspaper website in country) with multiple subdomains for different parts of portal (ie. elections, car etc.) The problem is that for front end development building all resources takes a lot of time which slows down development while only one part is worked on. For that purpose we decided to split encore webpack into multiple configs so front end team can launch encore watch only on required part. Problem is that we have lot of twig, with template overwriting in subdomains and we have lot of references to multiple CSS and JS files, separately for each domain. It's absolutely out of question to rewrite it from scratch to reference different entrypoints for each part. We had used (and are using) one entrypoints.js for all resources but this will not be possible with multiple output paths for different configs. So isn't there a way to have multiple configs, but let's say generate resources into one output path like we did before WITHOUT overwriting entrypoints and manifest files, but only generating common ones where everything is like it used to be? |
Uh oh!
There was an error while loading. Please reload this page.
Hi, comrades.
I'm trying to make multiple webpack configurations as described here -https://symfony.com/doc/current/frontend/encore/advanced-config.html#defining-multiple-webpack-configurations.
But, after compiling I get incorrect manifest and entrypoints files only with first entry and get error "An exception has been thrown during the rendering of a template ("Could not find the entry "mobile" in "/var/www/tst.loc/public/build/entrypoints.json". Found: entrypoints.")."
How to fix it?
webpack.config.js:
result of entrypoints.json:
result of manifest.json:
The text was updated successfully, but these errors were encountered: