C:\www\lookbook>yarn watch
yarn watch v0.27.5
$ encore dev-server --port 8090 --disable-host-check --hot
Running webpack-dev-server ...
WARNING Passing an absolute URL to setPublicPath() *and* using the dev-server can cause issues. Your assets will load from the publicPath (http://127.0.0.1:8090/) instead of from the dev server URL (http://localhost:8090/).
DONE Compiled successfully in 75262ms 21:33:25
WAIT Compiling... 21:33:25
DONE Compiled successfully in 214ms 21:33:25
WAIT Compiling... 21:34:12
@pcarballeda Were the 50 seconds also with Encore and using the same command (the optimizations are not the same between environments)? If that’s the case then the extra 50s are probably related to the content of those 6 files. You could maybe pinpoint what’s causing your issue by adding/removing things (either from the entry list or from the files themselves)?
@L3tum By “131 files”, do you mean entrypoints? In both cases, are you importing things in them? Don’t forget that Webpack has to process those imports as well.
That being said, having a build time of X minutes is definitely not normal. Documenting how to improve that is a bit hard because the issue will probably not be the same between two projects… but here are some things you could try:
--profile
option, you should be able to see a lot of metrics and maybe something will stand outresolveUrlLoader
option is known for slowing down some builds. It is enabled by default since imports in CSS files feel more natural this way (it makes the paths relative to the file you are editing), but you can disable it by using the second parameter ofEncore.enableSassLoader()
Encore.enableForkedTypeScriptTypesChecking()
to make the type-checking part of the build fasterimport { Observable, Subject } from 'rxjs'
instead ofimport * as rx from 'rxjs'
).I don’t think
Compiled successfully in 214ms
is too slow.By the way, don’t hesitate to use words and sentences the next time you want to communicate with humans.
Merry Xmas!! 🎉
I have a website with 114 entries and with my curent webpack configurarion, dev-server expenses about 50 seconds to compile all this assets. But with symfony encore I’ve just added 6 entries and expense about 100 seconds. So, definitely it’s to slow and documentation is really poor.
@slince Does it also do it when you specify the full scheme? For instance:
I suspect this is related to the
resolve-url-loader
that tries to resolve things like that. They fixed something similar a while ago (https://github.com/bholloway/resolve-url-loader/pull/68) but it only works if you specify the protocol.It doesn’t really matter since nothing should be downloaded in this case anyway.
For minimizing JS, yes