我学习了 Svelte 教程并component bindings
使用状态机重写了该部分中的键盘。那工作很可爱。
现在我想将Machine.svelte
文件提取到一个npm
包中,但我不知道该怎么做。我找不到任何有关发布的文档。对于我从svelte-virtual-list看到的内容,我可能必须配置 my 的main
orsvelte
字段package.json
:
{
"name": "@sveltejs/svelte-virtual-list",
"version": "3.0.0",
"description": "A <VirtualList> component for Svelte apps",
"main": "VirtualList.svelte",
"svelte": "VirtualList.svelte",
"scripts": {
"build": "rollup -c",
"dev": "rollup -cw",
"prepublishOnly": "npm test",
"test": "node test/runner.js",
"test:browser": "npm run build && serve test/public",
"pretest": "npm run build",
"lint": "eslint src/VirtualList.svelte"
},
"devDependencies": {
"eslint": "^5.12.1",
"eslint-plugin-svelte3": "git+https://github.com/sveltejs/eslint-plugin-svelte3.git",
"port-authority": "^1.0.5",
"puppeteer": "^1.9.0",
"rollup": "^1.1.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-svelte": "^5.0.1",
"sirv": "^0.2.2",
"svelte": "^3.0.0-beta.2",
"tap-diff": "^0.1.1",
"tap-dot": "^2.0.0",
"tape-modern": "^1.1.1"
},
"repository": "https://github.com/sveltejs/svelte-virtual-list",
"author": "Rich Harris",
"license": "LIL",
"keywords": [
"svelte"
],
"files": [
"src",
"index.mjs",
"index.js"
]
}
这是一个正确的假设吗?package.json.files
此外,我对 in theVirtualList.svelte
不存在的事实感到困惑?你将如何发布一个苗条的组件?
编辑:最终要点正确导入Machine
Svelte 组件