webpack-encore: Wrong entrypoints.json path
I’m having troubles with getting Webpack Encore to work nicely. I’m running Symfony 4.2.1 and followed the instructions. It’s working fine, but getting the links for stylesheets and scripts with the “encore_entry_link_tags” tag doesn’t work. It compiles just fine with all files in the correct folder.
Due to my host I need to use “public_html” as directory. I changed it in the composer.json file and the website is working fine. However, when using tags for rendering the tags is not working.
An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "C:/redacted/website/public/build/entrypoints.json" does not exist.").
So here Webpack thinks it should be in public/build, but it should be public_html/build. What am I missing? Webpack is putting the files in the right folder with this config:
// directory where compiled assets will be stored
.setOutputPath('public_html/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
I must be missing something obvious and small here… Tried to change the setPublicPath with public_html in front, but nothing seems to change when I edit that. Any ideas?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (1 by maintainers)
I had the same error until I run
npm run dev
Did you change the output_path in WebpackEncoreBundle config? It should be located in
config/packages/webpack_encore.yaml
and look like this:Hello Guys, i got the same error: You need to remove ENCORE in config/packages. But not manually, use that command:) composer rem symfony/webpack-encore-bundle As for me it has worked!
Oh duh! Sorry about that, overlooked the error as being the same. I uncommented the json_manifest_path in assets.yaml and it’s working now. Sorry for the trouble!
Not the same error then, one is related to
entrypoints.json
and the other one formanifest.json
😃 If it switches to themanifest.json
error, youroutput_path
andsetOutputPath()
values are probably right.That new error is not caused by the Encore Webpack Bundle but by the Asset component when you configure it to use the JSON Manifest Strategy.
You probably have a
json_manifest_path
key somewhere in your config files that doesn’t contain the right path.Hello, I don’t want to make a new issue but I was hoping you could possibly help. I am having the same problem as described above. I have json_manifest_path working correctly, recently upgrading from Webpack 2 to Webpack 4 due to this new functionality.
The file is correctly created in the correct directory (web/build/admin/manifest.json) from my webpack config. However, Symfony is still looking in the public directory for it. It finds the entrypoints.json file just fine.
There error:
It appears webpack encore does not take into account the asset package names? Thanks for your help.
Thanks Lyrkan. I upgraded my entire project and it looks like Symfony Flex had added another
assets.yml
file with that config, exactly what you said! Works wonderfully now. Thank you.Posting this in case others make this simple mistake!
Hi @Emirii,
Two different files here: the
entrypoints.json
and themanifest.json
.The first one (
entrypoints.json
) is only used by the Webpack Encore Bundle, for instance when you’re calling{{ encore_entry_script_tags(...) }}
and{{ encore_entry_link_tags(...) }}
.The second one (
manifest.json
) is not used by the Webpack Encore Bundle but by the Asset component, for instance when calling{{ asset(...) }}
in your Twig.The cause of the error you are getting could be that there is a
json_manifest_path
defined directly underframework.assets
somewhere in your config files and that you are callingasset(...)
without specifying a package name in your Twig (which makes it use the default package).