{"_id":"@alwing/vite-plugin-uni-resource-helper","_rev":"9-ff8f7bbbb16131c81f3cde10cc5cd2c8","name":"@alwing/vite-plugin-uni-resource-helper","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.0":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.0","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.0","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"4586de226940ccb97cce052d2028e0c7501301a7","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.0.tgz","fileCount":7,"integrity":"sha512-uKrFickCFQYBwtRGHdzdxqUDk26nU3dL+XBubUyW+Ps3pT6sc+kq3m1TDtKZz35VxJGMDu/tSe+QNTvPXzuYJQ==","signatures":[{"sig":"MEUCIQDLOyaFXM26o4n0Ch4LVR6vci9coPy/CZGQ5DtNHn9Y7QIgFmnS2pVnzRc5kIzhmpsQbhLVzpqFUbmNB9g8MZOsz/o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":472966},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.0_1751356432147_0.03208802198308214","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.1","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"MIT","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.1","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"396f802e1fc0b37b0d89c7fdaaa5839ab6ce6f79","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.1.tgz","fileCount":6,"integrity":"sha512-j26AdrYSku5lwkNsTVWozPh7xEdQxVP+fCErVAifmgrCPcC/SA9syngA/DiNMFiFf69YI7gtqDaTcf38BWEC+g==","signatures":[{"sig":"MEYCIQCwHum5vSNwfHd3Oc7R72mqSbKS/5cVlgPGtBdLHuHzHAIhAItJlePLg+Ej65SnhQOnocvj57Ue1wDs+Qn+UMTPKnb4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":472816},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.1_1751358015778_0.6072088463956444","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.2","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.2","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"253251a7d96e7cdc93aabc9cc13450718480da2b","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.2.tgz","fileCount":7,"integrity":"sha512-UbMUxVCT6LhC7MYb31lKCDRhbh/GO4plisBpS+kmDTV/2KabqzCUEg0qf7nr9YytAt070AWW4+2uoVF+bN1B2Q==","signatures":[{"sig":"MEYCIQCc4EM8d3RiWRlXPRYb8rI6edXEsNpe5i2Jx8NkZ8NWKQIhAO6aojQB2aw+FbGCHu1Wkx/NMsKp8SQnH/0GPXEpPqTh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":472966},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.2_1751358543700_0.06589926087071651","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.3","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.3","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"9a683d489ff990617cdb88e43acd85ebc9442918","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.3.tgz","fileCount":7,"integrity":"sha512-ybBjzp5/qnpF8rLzmSmR6ezAKPJvucSjbVt6SzJSjNLlkfUK9ZKLBTHf/iMpuL67Av23vyP3/d4s2V6qY1maKg==","signatures":[{"sig":"MEYCIQDoanONU65RoiCBdhjkn/c65VvBBcQPg0SC07Y80E69fwIhAPerGA+F10F2r+95ejJ2Tr9WzH8tajhaUf0fzGiMe5lN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":472786},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.3_1751445063024_0.21639440257594922","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.4","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.4","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"b811fec9770a6129376da968d5c3de16813a7d3f","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.4.tgz","fileCount":7,"integrity":"sha512-bEiR2tH0rHeVOfktTpucI5neGn+p1vMIhA6vUDdA0yaErMagH9de9gSoeXE/+6RKZHwC1ddqRtBUTunGB/JPnw==","signatures":[{"sig":"MEUCIQD+CNSCGgy9t/S3bFyGb74tNh/M3v0G5h3VdEqmkfFDGwIgZ4vrVc29SledZMwLGl9NgxlglC5cSbsxtUVGGto+JBc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":473644},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.4_1751509909773_0.31105680458970797","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.5","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.5","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"7671e84cde96cfb63308c93660f31399666b7676","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.5.tgz","fileCount":7,"integrity":"sha512-oaTWKJNtIrgCXpyD+oSj3vk7jUvVrQj9uAnsLd1qccNvvF/S9yJm7fji6dvSeoheKpIPvSUGkI3e82KEPBflog==","signatures":[{"sig":"MEUCIC49/Cj6H/TOF4ZyReNO3FTYSa84yYGjcvK7QGfUyeM4AiEAvb7XvNmkNKMJA7aLu+wEvqQC4j0JdCs5M8rQbvxax10=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":473951},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.5_1751525961729_0.018822192573767715","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.6","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.6","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"2a0db88744b4446825a5a0f21bbd4ac257fb8f1c","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.6.tgz","fileCount":7,"integrity":"sha512-OIxdEvsiybB6TsTtb9Hx5XZoGeYLQwvYRRdr14xHflI3ITSPjDSwGHl6EOC/7Xa7k1dUkhSlcoekcRVHS1mWpQ==","signatures":[{"sig":"MEQCIF4jDncsrA2izKoxXtuKxqy75Iq7yGP/sxLsxN49K5voAiBZjEu89sv9xHmyTagNS1XrYxjEJqS7HG1uhYMG9dfO5A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":473972},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","actor":{"name":"alwing","type":"user","email":"904618103@qq.com"},"email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.6_1751866546416_0.8515911265181697","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.7","keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","_id":"@alwing/vite-plugin-uni-resource-helper@1.0.7","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"dist":{"shasum":"e12918d5bbc9a12416c53083794afcc63f021d3d","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.7.tgz","fileCount":7,"integrity":"sha512-n8zX4QH7WBhkdH7PBcpQdPmTgL1yZZeCbZN68XS55Mtwzv2rlQj8U7q1uXcFHBCavbkr/FL4WiALi6PoCbE6Kg==","signatures":[{"sig":"MEYCIQChHLmNwlycXYa4KDkJI7ty3CtGULO+Nqy9Dnzy/+CfZgIhAOdkGVHq+ZnmQ2uSSV5tfEgUScz7wLxyy2IevusFjrjj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":474000},"main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"alwing","email":"904618103@qq.com"},"_npmVersion":"10.8.1","description":"自动生成静态资源引用","directories":{},"_nodeVersion":"22.4.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.8","typescript":"^5.6.2"},"peerDependencies":{"vite":"^5.2.8"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-uni-resource-helper_1.0.7_1754272559175_0.365619361502423","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"@alwing/vite-plugin-uni-resource-helper","version":"1.0.8","description":"自动生成静态资源引用","main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["vite","uniapp","uni-resource-helper"],"author":{"name":"alwing"},"license":"ISC","peerDependencies":{"vite":"^5.2.8"},"dependencies":{"chokidar":"^3.6.0"},"devDependencies":{"typescript":"^5.6.2","vite":"^5.2.8"},"_id":"@alwing/vite-plugin-uni-resource-helper@1.0.8","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-GOlBLb07oHS/bSWayzi4+j5alL/VTaQd/EVyFYmHJGkTaSXnmlw8jkrnusWAY3KV+GYXhhVfJovSyN7xX9Y6eg==","shasum":"1dcc0de86279333db79efbfd939f685f377444af","tarball":"https://registry.npmjs.org/@alwing/vite-plugin-uni-resource-helper/-/vite-plugin-uni-resource-helper-1.0.8.tgz","fileCount":7,"unpackedSize":474267,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDNNOmbjZ5PXmB5KV3U8bKcvZTLySB6b4tDlBYIDAjlOQIgNgz3vlb0A40FBOv9Q4vp09c5V479/sybn23vBd4xPzw="}]},"_npmUser":{"name":"alwing","email":"904618103@qq.com"},"directories":{},"maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-uni-resource-helper_1.0.8_1788417789419_0.022249859811599437"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-01T07:53:52.055Z","modified":"2026-09-03T06:43:09.735Z","1.0.0":"2025-07-01T07:53:52.407Z","1.0.1":"2025-07-01T08:20:15.997Z","1.0.2":"2025-07-01T08:29:03.974Z","1.0.3":"2025-07-02T08:31:03.246Z","1.0.4":"2025-07-03T02:31:50.005Z","1.0.5":"2025-07-03T06:59:21.979Z","1.0.6":"2025-07-07T05:35:46.634Z","1.0.7":"2025-08-04T01:55:59.390Z","1.0.8":"2026-09-03T06:43:09.557Z"},"author":{"name":"alwing"},"license":"ISC","keywords":["vite","uniapp","uni-resource-helper"],"description":"自动生成静态资源引用","maintainers":[{"name":"alwing","email":"904618103@qq.com"}],"readme":"# @alwing/vite-plugin-uni-resource-helper\n\n- uniapp cli项目 vite插件 \n\n  vue页面模版中通过`assets.xxx`访问静态资源，访问静态资源时自动补全路径\n\n\n- 安装\n\n  ```shell\n  npm install @alwing/vite-plugin-uni-resource-helper\n  ```\n\n- vite环境变量初始化​\n\n  项目更目录下新建`env`目录\n\n  env目录下新建`.env.development`和`.env.production`\n\n  ```sh\n  # 微信小程序环境下，static目录会被打包到本地，容易超2M的限制\n  # 因此微信小程序环境，可以将静态资源打包放到服务器，此处就可以设置静态资源的服务器前缀\n  VITE_FTP_URL = `http://127.0.0.1:8849/base_pro/images`\n  \n  # 静态资源/ftp前缀\n  VITE_FTP_URL = `/static/images`\n  ```\n  \n  `vite.config.js`中配置`envDir`\n  \n  ```javascript\n  export default ({ command, mode }) => {\n  \treturn defineConfig({\n  \t  envDir: \"./env\",\n  \t  plugins: [\n  \t\t  uni()\n  \t  ]\n  \t})\n  }\n  ```\n\n\n- `vite.config.js`中导入\n\n  ```javascript\n  import uni from '@dcloudio/vite-plugin-uni'\n  import uniResourceHelper from \"@alwing/vite-plugin-uni-resource-helper\";\n  \n  export default ({ command, mode }) => {\n  \treturn defineConfig({\n  \t  envDir: \"./env\",\n  \t  plugins: [\n  \t\t  uni(),\n        uniResourceHelper({\n  \t\t\t  dts: \"./src/assets.d.ts\",            //.d.ts生成路径\n          // inputDir: \"./src/static/images\"    //静态资源存放路径\n  \t\t\t  inputDir: \"./images\"       //静态资源存放路径\n  \t\t  })\n  \t  ]\n  \t})\n  }\t\n  ```\n  \n\n- 页面中使用\n\n  `main.js`引入(VUE3)\n\n  ```javascript\n  import { createSSRApp } from \"vue\";\n  import App from \"./App.vue\";\n  import { ASSETS } from \"virtual:resource-helper\";\n  \n  export function createApp() {\n    const app = createSSRApp(App); \n    app.config.globalProperties[\"assets\"] = ASSETS;\n    return { \n      app,\n    };\n  }\n  ```\n\n  页面中使用\n\n  ```vue\n  <template>\n    <view class=\"content\">\n      <image class=\"logo\" :src=\"assets?.ic_tab_todo\" />\n    </view>\n  </template>\n  ```\n\n  模版中敲`assets.`代码自动提示配置\n\n  修改`shims-uni.d.ts`\n\n  ```typescript\n  /// <reference types='@dcloudio/types' />\n  import 'vue'\n  \n  declare module '@vue/runtime-core' {\n    type Hooks = App.AppInstance & Page.PageInstance;\n  \n    interface ComponentCustomOptions extends Hooks {\n  \n    }\n    \n    interface ComponentCustomProperties extends Hooks {\n    \tassets?: ImageResource\n    }\n  }\n  ```\n\n  修改`src/shims-uni.d.ts`\n\n  ```typescript\n  export {}\n  \n  declare module \"vue\" {\n    type Hooks = App.AppInstance & Page.PageInstance;\n    interface ComponentCustomOptions extends Hooks { \n  \t  \n    }\n    interface ComponentCustomProperties extends Hooks {\n    \tassets?: ImageResource\n    }\n  }\n  ```\n\n  \n\n","readmeFilename":"README.md"}