xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

看了这篇使用 dist 发布 npm 包的文章,我整个人都栓Q 了

看了这篇使用 dist 发布 npm 包的文章,我整个人都栓Q 了

手动复制粘贴 ?

npm 发布包的正确打开方式

✅ 使用 files 指定要上传 npm 的所有文件

{
  "name": "lit-wcui",
  "version": "1.0.4",
  "description": "lit version wcui 🚀",
  "main": "./dist/index.esm.js",
  "browser": "./dist/index.umd.js",
  "iife": "./dist/index.iife.js",
  "types": "./dist/index.d.ts",
  "scripts": {
    "dev": "yarn rm && yarn cp && rollup -w -c rollup.config.js",
    "build": "yarn rm && yarn tsc && rollup -c",
    "tsc": "tsc",
    "tscd": "tsc -d",
    "tscw": "tsc -w",
    "rm": "rm -rf ./dist/*.*",
    "cp": "cp ./test/index.html ./dist/index.html",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "lit",
    "web components",
    "wcui",
    "typescript",
    "cdn",
    "umd",
    "esm",
    "iife"
  ],
  "files": [
    "dist/*",
    "package.json",
    "README.md",
    "LICENSE"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/xgqfrms/wcui.git"
  },
  "bugs": {
    "url": "https://github.com/xgqfrms/wcui/issues"
  },
  "homepage": "https://github.com/xgqfrms/wcui/tree/main/lit-version#readme",
  "author": "xgqfrms",
  "license": "MIT",
  "dependencies": {
    "lit": "^2.2.8"
  },
  "devDependencies": {
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^13.3.0",
    "@rollup/plugin-typescript": "^8.3.3",
    "rollup": "^2.77.1",
    "tslib": "^2.4.0",
    "typescript": "^4.7.4"
  }
}

export from import

import sum form "./sum.ts"

export sum;
// export from 
export sum form "./sum.ts"

模块重定向, 聚合多个子模块的中的导出 ✅

https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/export#模块重定向

export {sayHi} from './say.js'; 
// re-export sayHi

export {default as User} from './user.js'; 
// re-export default

https://javascript.info/import-export#re-export

栓Q

栓Q,网络流行语,英文短语“thank you”的读音空耳衍生,英文的本意是感谢。 后来衍生为表达自己很无语,对某件事特别讨厌的情绪。

https://www.youtube.com/watch?v=AMoXFPnf7kE

https://www.bilibili.com/video/BV1VA4y1f7f8

https://www.youtube.com/watch?v=xw6Mio_Vq3g

refs

bad case

https://github.com/szqlovepk/utilibs/blob/main/src/index.ts

https://github.com/szqlovepk/utilibs/blob/main/package.json

https://juejin.cn/post/7093218148299571231



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-07-28 13:25  xgqfrms  阅读(262)  评论(1编辑  收藏  举报