Javascript 如何将stenciljs组件导入到另一个配置了require的项目中?

Javascript 如何将stenciljs组件导入到另一个配置了require的项目中?,javascript,requirejs,amd,tsconfig,stenciljs,Javascript,Requirejs,Amd,Tsconfig,Stenciljs,我已经开发了一个用于现有项目的示例模具组件,它通过requirejs加载了所有依赖项。我无法导入到现有项目 我试过在模具项目的tsconfig.json中使用modulevalueamd、commonjs、targetes3、es5进行不同的配置,但似乎都不起作用 模具构建后,dist文件夹结构如下: + cjs + collection + esm + fonts + icons + index.js + loader + types + my-component.json + my-comp

我已经开发了一个用于现有项目的示例模具组件,它通过requirejs加载了所有依赖项。我无法导入到现有项目

我试过在模具项目的
tsconfig.json
中使用
module
value
amd
commonjs
、target
es3
es5
进行不同的配置,但似乎都不起作用

模具构建后,
dist
文件夹结构如下:

+ cjs
+ collection
+ esm
+ fonts
+ icons
+ index.js
+ loader
+ types
+ my-component.json
+ my-component
   - fvhzbl6z.entry.js
   - fvhzbl6z.es5.entry.js
   - fvhzbl6z.sc.entry.js
   - fvhzbl6zsc.es5.entry.js
   - my-component.abuimksq.js
   - my-component.u8wgqi9a.js
+ my-component.js         /* I'm trying to import this file */
我试着将
mycomponent
文件夹和
mycomponent.js
复制到一个单独的文件夹中,并在一个示例html文件中引用了
mycomponent.js
,效果很好。但将其导入现有项目会引发错误

require([
    'jquery',
    'lib/bluebird',
    'lib/mycomponent/my-component'
],
function (
    $,
    Promise,
    MyComponent
) {
    'use strict';

    /* some stuff here */

}
我得到以下错误:

运行“requirejs:dist”(requirejs)任务
错误:使用esprima解析文件时出错:/Users/sudouser/Downloads/jsproject/dist/tmp/js/lib/stencilcomponent/my component/fvhzbl6z.entry.js
错误:第1行:意外标记
在模块树中:
应用程序