{"id":19451208,"url":"https://github.com/thekashey/runtime-compress-loader","last_synced_at":"2026-03-17T02:51:06.761Z","repository":{"id":57355841,"uuid":"154963827","full_name":"theKashey/runtime-compress-loader","owner":"theKashey","description":"babel and typescript \"runtime\" helpers optimization loader","archived":false,"fork":false,"pushed_at":"2019-09-27T05:39:36.000Z","size":7,"stargazers_count":24,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T15:47:02.417Z","etag":null,"topics":["babel","helpers","optimization","typescript","webpack-loader"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theKashey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-27T12:47:55.000Z","updated_at":"2024-01-29T14:08:06.000Z","dependencies_parsed_at":"2022-09-05T22:12:43.709Z","dependency_job_id":null,"html_url":"https://github.com/theKashey/runtime-compress-loader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theKashey%2Fruntime-compress-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theKashey%2Fruntime-compress-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theKashey%2Fruntime-compress-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theKashey%2Fruntime-compress-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theKashey","download_url":"https://codeload.github.com/theKashey/runtime-compress-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250754501,"owners_count":21481823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","helpers","optimization","typescript","webpack-loader"],"created_at":"2024-11-10T16:40:45.014Z","updated_at":"2026-03-17T02:51:06.707Z","avatar_url":"https://github.com/theKashey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# runtime-compress-loader\n----\nRemoves the \"inline\" helpers, babel and typescript inlines to the every file, greatly reducing size of your application __before the gzip__, making it loads and runs faster.\n\n## What it does\n\nFinds babel and typescript helpers and replaces them by code from `@babel/runtime` and `tslib` \n\nIt's usually a __kilobyte in every file__ you have a class inside. How many files you have? Well, you got the point.\n\nSo what it does? It replaces inlined `babel-helpers` by `imported` ones, keeping only one version of them.\nWorks as well for `rslib` helpers.\n```diff\n-var _extends = Object.assign || function (target) { for (var i = 1; i \u003c arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n+import _extends from '@babel/runtime/helpers/esm/extends';\n+import _createClass from '@babel/runtime/helpers/esm/createClass';\n```\n\n## Usage\nJust add this webpack loader before any other for node_modules, and after any other for other locations. \n\n### For project files\n```js\n{\n    test: /\\.js$/,\n    exclude: /node_modules/,\n    loaders: ['runtime-compress-loader', 'babel-loader'],  \n}\n```\n\n### For node modules\n```js\n{\n    test: /\\.js$/,\n    include: /node_modules/,\n    loaders: ['runtime-compress-loader'],  \n}\n```\n\n### For any location\n```js\n{\n    test: /\\.js$/,\n    loaders: ['runtime-compress-loader', 'babel-loader', 'runtime-compress-loader'],  \n}\n``` \n\n## Other ways\n\n- [babel-plugin-transform-runtime](https://babeljs.io/docs/en/babel-plugin-transform-runtime) - and __the why__. User babel to do the job.\nFor project, not yet transpiled files only.\n\n- [tslib](https://github.com/Microsoft/tslib) - `importHelpers` for typescript\n\n- [jsx-compress-loader](https://github.com/theKashey/jsx-compress-loader) - almost the same \"compressing\" operation, but for React.createElement only.\n\n# Licence\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekashey%2Fruntime-compress-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthekashey%2Fruntime-compress-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekashey%2Fruntime-compress-loader/lists"}