Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/449.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法解析nextjs中的typescript模块_Javascript_Typescript_Webpack_Next.js_Stenciljs - Fatal编程技术网

Javascript 无法解析nextjs中的typescript模块

Javascript 无法解析nextjs中的typescript模块,javascript,typescript,webpack,next.js,stenciljs,Javascript,Typescript,Webpack,Next.js,Stenciljs,我有一个带有typescript的小nextjs应用程序,它可以呈现用stenciljs创建的web组件。组件被构建并导出到库my components和my components library react(后者是一个封装了组件的库,便于使用react)。我使用tsconfig.json中的path解析模块: { "compilerOptions": { "baseUrl": ".", "paths&qu

我有一个带有typescript的小nextjs应用程序,它可以呈现用stenciljs创建的web组件。组件被构建并导出到库
my components
my components library react
(后者是一个封装了组件的库,便于使用react)。我使用
tsconfig.json
中的
path
解析模块:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "my-components-library-react": ["../my-components-library-react/src/index.ts"]
    },
...
}
当我尝试加载模具组件时,接下来会抛出一个错误:

模块分析失败:意外令牌(6:12) 您可能需要适当的加载程序来处理此文件类型,目前没有配置加载程序来处理此文件。看见 从“/react component lib”导入{createReactComponent}; 从“我的组件”导入类型{JSX}

编译
my components library react
并解析为js文件时,一切正常(
“my components library react”:[“./my components library react/dist/index.js”]

为什么webpack不能加载外部ts文件以及如何实现这一点?

尝试使用编译库。