如何通过aurelia基于CLI的应用程序提供aurelia库供消费者使用

Kev*_*nio 5 aurelia aurelia-cli

我正在构建一个aurelia自定义元素库,供几个不同的aurelia应用程序使用,并且在使用CLI进程正确地将自定义元素html连接到应用程序包中时遇到了麻烦.

我目前认为该库将是package.json的一部分,因此列在node_modules/my-lib下.交付的.html格式应该是什么

<template>...</template> 
Run Code Online (Sandbox Code Playgroud)

或者是否应以所需格式交付

define('text!my-lib/component1.html', ['module'], function(module) { module.exports = "<template>\r\n  ...
Run Code Online (Sandbox Code Playgroud)

如果是前者 - 我在aurelia.json中放置什么才能将它正确地包含在供应商包中?

如果我在my-lib依赖部分中依赖['../ node_modules/my-lib/**/*.html'],它将作为html包含在js文件中,从而引发错误.

如果我将source添加为vendor-bundle或使用我自己的bundle my-lib-bundle.js

"source": [
    "[../node_modules/my-lib/**/*.js]",
    "../node_modules/my-lib/**/*.{css,html}"
],
Run Code Online (Sandbox Code Playgroud)

除了一个依赖项中列出的"main"之外,什么都没有包括在内.

如果我添加到markupProcess(它似乎更多地链接到应用程序而不是库)

"markupProcessor": {
    "id": "none",
    "displayName": "None",
    "fileExtension": ".html",
    "source": [
        "src\\**\\*.html",
        "..\\node_modules\\my-lib\\**\\*.html"
    ]
},
Run Code Online (Sandbox Code Playgroud)

我将html正确添加到app-bundle但是路径错误,因为它在define中包含'../node_modules',因此当应用程序尝试使用它时找不到它.

我没有使用CLI来构建我的lib,因为我希望应用程序只包含它使用的部分.所以JS是以AMD格式构建和交付的,但我不确定使用HTML的过程?

建议?

Ale*_*ran 0

有一个骨架插件仓库@ github https://github.com/aurelia/sculpture-plugin

带有构建脚本和所有