我有一个使用Typescript文件构建的Next.js应用程序A
,以及一个名为B
的包,该包包含以下index.tsx
文件:
export default () => {
console.log('hi');
}
当我通过以下方式在Next.js应用程序A的任何文件中导入它时:
import f from 'B';
我遇到了这个错误:
ModuleParseError: Module parse failed: Unexpected token (15:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
这似乎与Webpack有关,但我不知道如何解决它。