-
Notifications
You must be signed in to change notification settings - Fork 12k
Build to a single js file, not 4 files #3288
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 understand why this is useful, and it could be done. |
this is useful https://github.com/dfsq/compressJS.sh |
I have a similar use case and would love to see this feature! |
This isn't something we're looking at doing nowadays. It's good to have several files for caching purposes, since part of your app might still be cached on the client. |
Proceed as follows:
|
Not using the angular cli in the problem solution, but my simple hack fix to getting one file with the package concat-files:
Obviously will not run if you are not outputting any of these files or if the output directory is different than the current. The build command can be further customized, but is a good starting place. LMK if theres anything I should add and hope it helps someone :) |
Well, it's easy to just concat js files in a build step. What's not easy is that we would like sourceMaps ( Any solution to that? BTW, we're using |
No sir I dont, would also be interested in a solution that preserves source maps but I dont work on angular or webpack, just providing a solution for people who want 1 file output based on what we do in production. |
@bluwaterdogz see my post above. I use this approach and works flawlessly with source maps. |
I'm doing the same, but I still have 3 bundles:
Vendor and polyfills are removed. |
Regarding |
The old "inline" made sense to be in-line, and I suspect whoever initially named it that way had this in mind. I had opened issue #2307 long ago, soon after this design appeared. However I believe the team has already considered this and decided not to put the content inline; instead it was renamed runtime. (However, in some projects I do something similar to the above, mechanically putting this small amount of frequently changing JavaScript in the HTML file to save one round-trip per fresh page load. I find this worthwhile, between now and when HTTP2 becomes universal.) |
Wouldn't this remove the polyfills file? dropping support for IE11 or order browsers |
Yes, it removes the polyfills file. Or better, doesn't create one. I'm unsure why so many people dislike this solution. AFAIK it's the only published workaround that works. I've been using it for ~2 years. The downside is not being officially supported and so may stop working any time. It works with v6.2.1, I believe it will require some upkeep from what I've seen from v7+. |
Any news on if this was accomplished without the seeming hacks here and there? |
You could use @angular-builders/custom-webpack. Example usage:
|
@filipesilva so what would you suggest to users who are forced to host their apps in environments where single file is required? E.g. users must provide a runtime token in order to load a script, but service workers are not allowed due to support of IE11 |
Here there are a simple Gulp Script that concatenates the principal JS files (main, polyfills, vendor, runtime), Case Angular 7. The taks name is singleJSFILE
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sorry if it not the right place for such a question, but Angular-Cli team looks like the best answerer for it.
Angular-cli builds all code into several js files: main.bundle.js, inline.bundle.js, scripts.bundle.js and styles.bundle.js.
There are many people who would love to see only one file mostly for performance reasons.
Just one .js file with everything.
1)Is it configurable/possible?
2)Was the configuration with 4 files done on purpose, will there be huge architectural complications caused by moving to a single file?
The text was updated successfully, but these errors were encountered: