{"id":19071933,"url":"https://github.com/cyansalt/vue2-script-setup-loader","last_synced_at":"2025-04-18T06:32:30.157Z","repository":{"id":57690207,"uuid":"481584609","full_name":"CyanSalt/vue2-script-setup-loader","owner":"CyanSalt","description":"💡 Bring `\u003cscript setup\u003e` to Vue 2.","archived":false,"fork":false,"pushed_at":"2023-12-07T12:57:34.000Z","size":285,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-12-07T13:37:15.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyanSalt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-14T11:49:27.000Z","updated_at":"2023-08-24T12:58:03.000Z","dependencies_parsed_at":"2023-12-07T13:47:05.036Z","dependency_job_id":null,"html_url":"https://github.com/CyanSalt/vue2-script-setup-loader","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"602f1a0bb54c5da838d736e1b68d5638b3e0d84c"},"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fvue2-script-setup-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fvue2-script-setup-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fvue2-script-setup-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fvue2-script-setup-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyanSalt","download_url":"https://codeload.github.com/CyanSalt/vue2-script-setup-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223775897,"owners_count":17200579,"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":[],"created_at":"2024-11-09T01:32:50.396Z","updated_at":"2024-11-09T01:32:51.439Z","avatar_url":"https://github.com/CyanSalt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue2-script-setup-loader\n\n[![npm](https://img.shields.io/npm/v/vue2-script-setup-loader.svg)](https://www.npmjs.com/package/vue2-script-setup-loader)\n\n\u003e [!NOTE]\n\u003e This package has strong limitations and it is recommended to use [parallelize-webpack-unplugin](https://github.com/CyanSalt/parallelize-webpack-unplugin) instead.\n\n\u003e [!NOTE]\n\u003e In addition, since `unplugin-vue2-script-setup` is no longer maintained, if you expect to use it under Vue 2.7, it is recommended to use `parallelize-webpack-unplugin` with [`@vue-macros/reactivity-transform`](https://vue-macros.sxzz.moe/features/reactivity-transform.html)\n\n---\n\nBring [`\u003cscript setup\u003e`](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to Vue 2.\n\nIt's really just another wrapper for [`unplugin-vue2-script-setup`](https://github.com/antfu/unplugin-vue2-script-setup).\n\n### Why not just use `unplugin-vue2-script-setup` ?\n\nBecause Unplugin uses non-serializable loader options when adding functionality to Webpack, which will cause the worker of `thread-loader` to not work properly (e.g. with the default configuration of the Vue CLI).\n\nFortunately, it can be avoided by using a loader that is handled completely independently, and it is especially easy since `unplugin-vue2-script-setup` only uses the `transform` API. The only caveat is that you may need to manage the files you wish to transform manually, including `.vue` or `.js/ts` files.\n\n## Installation\n\n```shell\nnpm install -D vue2-script-setup-loader\nnpm i @vue/composition-api\n```\n\nInstall [`@vue/composition-api`](https://github.com/vuejs/composition-api) in your App's entry (it enables the `setup()` hook):\n\n```javascript\nimport Vue from 'vue'\nimport VueCompositionAPI from '@vue/composition-api'\n\nVue.use(VueCompositionAPI)\n```\n\n## Usage\n\n```javascript\n// webpack.config.js\nmodule.exports = {\n  // ...\n  module: {\n    rules: [\n      {\n        test: /\\.vue$/i,\n        use: [\n          {\n            loader: 'vue-loader',\n          },\n          // Add it here\n          {\n            loader: 'vue2-script-setup-loader',\n            options: {\n              // Enable reactivity transform\n              reactivityTransform: true\n            },\n          },\n        ],\n      },\n    ],\n  },\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyansalt%2Fvue2-script-setup-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyansalt%2Fvue2-script-setup-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyansalt%2Fvue2-script-setup-loader/lists"}