-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
DLL Integration #1358
DLL Integration #1358
Conversation
fix: load zone.js for dev in 2 sub entries
@shlomiassaf that's impressive! You took what I did to a higher level. Obviously it's better to handle the DLL build inside a Webpack plugin rather than the npm scripts. Just a couple small points:
The bottom line is that DLLs make dev builds run a lot faster, once the DLLs are built. This is a good merge as long as it doesn't have unexpected side effects or break existing builds that otherwise work. |
Another idea is to extract the DLL into a separate config file (I used |
LGTM |
@colinskow Once the config file is part of the repo it doesn't matter, you have to change the code. I agree that splitting into a different file has logic to it but I also don't like to many configuration files... so my thought was lets make it super light, nothing fancy and if the user wants a more advanced config he can do it. In 99% of the use cases the common config is sufficient. The config file for the DLL has nothing to it, it's based on the common... so, IMO, no need to have another config file. As for unit tests, agreed, but as you can see from my post, I asked for help on that :) I'll post a clean script later. |
@fxck does this look reasonable for you? |
So we're just missing feedback from @d3viant0ne. My thinking on separating the config file is that if I want to pull the latest |
I agree that it should be in a separate file, ideally you shouldn't need to touch webpack configs at all, makes updating so much easier. But then again, the whole config should be rewritten in a way similar to this https://github.com/katallaxie/angular2-preboot/blob/master/config/env.ts https://github.com/katallaxie/angular2-preboot/blob/master/webpack.config.ts#L197 |
I agree that making the configs easily extensible would be a definite plus as is limiting the need to touch the webpack configs directly. Both the preboot & @qdouble's starter do an excellent job of accomplishing this. |
OK, agreed. Are we going to do it in this PR or we can wait for a refactor for the whole branch? |
I have 3 features I want to implement on the plugin:
Does anyone want to help? |
Please don't merge yet, might have found a bug. |
@shlomiassaf - I am personally leaning towards just doing it here if you are up for it. If you don't have the time, I can PR the changes into this branch on your fork and we can land it all at once that way. Either way it goes, any time we can limit the number of major changes the users have to contend with, the better imo. |
@d3viant0ne I'm not sure I will get to it today so feel free to do whatever :) BTW, I fixed the bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@shlomiassaf, can you clarify something for me? I've pulled these changes into our build system which is based off of this starter. What I'm seeing is a vendor.dll.js and vendor.bundle.js, both of which contain all of the angular libs. Should there even be a vendor.bundle.js anymore? |
Since pulling these changes in, I've just noticed that in prod builds "process" is not defined, whereas it is there in dev builds/runs. Just guessing, but could this be a polyfill compilation/inclusion bug with the webpack.prod.js file stemming from this DLL change? EDIT: to clarify, I mean that |
@bmayen you might see some vendor.bundle but it should be small containing some packages not registered with the plugin. The way vendors.bundle is configured is that every package that repeats multiple times goes into it so it's easy to forget some... If all are there you probably have a build with aliasing/moduleDirs that somehow resolves to a non matching resource id Every resource in webpack gets an id, so alias eventually resolved to the same id as the direct path... this is probably not working for u |
Just pulled down the repository fresh and can confirm that somehow the UPDATE: issue #1375 |
The "DllBundlesPlugin" seems not works properly with "ProvidePlugin". In my case i want to expose jQuery (because i'm using angular 1.6 with babel) I've tried this :
Doesn't work, try with :
It works, but it's not very clean, any idea ? Thanks ! |
@fryck try: externals: {
// require("jquery") is external and available
// on the global var jQuery
"jquery": "jQuery"
} |
If this works we should create a Wiki, add this, and remove the deprecated Wikis. |
* build: add dll support * misc: fix dependency category fix: load zone.js for dev in 2 sub entries * misc: clean dll directory * misc: fix caching bug
@colinskow @abhishekisnot @d3viant0ne @gdi2290
This is my take on DLL integration: Using a plugin to control the whole process.
The plugin internally injects the low level DLL plugins provided by webpack (
DllPlugin
,DllRegerencePlugin
) into the webpack instances.The plugin handles both the webpack instance it get's registered on and a new webpack instance it creates for bundle generation.
The sole purpose of this plugin is to detect changes to the bundle structure.
Few points:
The plugin is async (promises). This is for future support of webpack package resolution (currently using node). This is important since webpack can resolve from other directories other then
node_module
.The plugin is ready for live re-bundling. It detects a change in the package level so it can trigger a build per bundle. This will come in handy once live re-bundling is supported.
No need for extra configuration, everything is in the plugin, no extra commands.
This makes it super easy to opt-out, just remove the plugin from
plugins
See source code
Change to the repo is minimal.
PLEASE DO NOT MERGE UNTIL DISCUSSION ENDS
I did not have time for unit tests and proper documentation, I this PR is accepted I will appreciate any help on tests, documentation and adding support to some features.
Thanks.