Comments (4)
I'm not sure :). Each file should only run 1 time. Perhaps you can throw an error in the file to see where each "call" is coming from.
from webpack-encore-bundle.
html v1)
{% block javascripts %}
{{ encore_entry_script_tags('media')}}
{% endblock %}
console result
test media ( 1 call)
html v2)
{% block javascripts %}
{{ parent() }}
{% endblock %}
console result
test app ( 1 call)
html v3)
{% block javascripts %}
{{ parent() }}
{{ encore_entry_script_tags('media')}}
{% endblock %}
console result
app.js:29 test app.
media.js:4 test media
app.js:29 test app
media.js:4 test media
why call console 2 time???
from webpack-encore-bundle.
The cause I think is this: TagRenderer entrypointLookupCollection
(yaml.xml)
2 call yaml.xml
'webpack_encore.entrypoint_lookup_collection' => static function(): EntrypointLookupCollectionInterface {
$serviceLocator = new ServiceLocator(['_default' => function() {
return new EntrypointLookup(DIST_PATH . '/entrypoints.json');
}]);
return new EntrypointLookupCollection($serviceLocator);
},
'webpack_encore.packages' => static fn(): Packages => new Packages(
new Package(new JsonManifestVersionStrategy(DIST_PATH . '/manifest.json'))
),
'webpack_encore.tag_renderer' => static fn(ContainerInterface $container): TagRenderer => new TagRenderer(
$container->get('webpack_encore.entrypoint_lookup_collection'),
$container->get('webpack_encore.packages')
),
1 call yaml.xml
'webpack_encore.packages' => static fn() => new Packages(
new Package(new JsonManifestVersionStrategy(DIST_PATH . '/manifest.json'))
),
'webpack_encore.tag_renderer' => static fn(ContainerInterface $container) => new TagRenderer(
new EntrypointLookup(DIST_PATH . '/entrypoints.json'),
$container->get('webpack_encore.packages')
),
but 1 call yaml.xml is trigger_error !!
from webpack-encore-bundle.
before my code << encore_entry_script_tags * count is call ( new Instance )
'webpack_encore.entrypoint_lookup_collection' => static function(): EntrypointLookupCollectionInterface {
$serviceLocator = new ServiceLocator(['_default' => function() {
return new EntrypointLookup(DIST_PATH . '/entrypoints.json');
}]);
return new EntrypointLookupCollection($serviceLocator);
},
after my code
'webpack_encore.entrypoint_lookup_collection' => static function(): EntrypointLookupCollectionInterface {
$entrypointLookup = new EntrypointLookup(DIST_PATH . '/entrypoints.json');
$serviceLocator = new ServiceLocator(['_default' => function () use ($entrypointLookup) {
return $entrypointLookup;
}]);
return new EntrypointLookupCollection($serviceLocator);
},
from webpack-encore-bundle.
Related Issues (20)
- Webpack Encore context directory issue
- Yarn warning when updating webpack-cli to v5 HOT 1
- Missing entrypoints.json when installing from scratch on Symfony HOT 1
- import js & css files from TwigExtension with stimulus controllers HOT 5
- Unknown "encore_entry_link_tags" function HOT 4
- Add Twig function and filter for Stimulus Outlets integration HOT 2
- Move Stimulus helpers to UX repository HOT 1
- Unable to preload links: feature not supported HOT 4
- 2.0 not usable with symfony 5.4 (twig-bundle conflict) HOT 1
- recipe update not working HOT 3
- Error when reusing Symfony web server SSL certificate HOT 1
- preload + integrity hash + cloudflare HOT 2
- assets base_path parameter not considered by encore_entry_link_tags and encore_entry_script_tags functions HOT 5
- PreloadAssetsEventListener does not use integrity hashes HOT 6
- Package installation is broken on SF 5.4 is broken HOT 1
- Deprecation with Symfony 6.4: Symfony\WebpackEncoreBundle\CacheWarmer\EntrypointCacheWarmer::doWarmUp() ... HOT 2
- package.json not updated
- ock content hash
- encore_entry_link_tags incorrectly querying manifest.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-encore-bundle.