In my Next.js application A
, I am using only Typescript files and have a package B
containing an index.tsx
file like this:
export default () => {
console.log('hi');
}
However, when I try to import it in any file within my Next.js app A using:
import f from 'B';
I encounter the following error:
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
This issue seems to be related to Webpack, but I'm unsure of how to resolve it.