[英]next js with Turborepo ui package import through error: You may need an appropriate loader
I'm working with next.js 13.1.1 and first time configuring a monoRepo-based project using turborepo .我正在使用 next.js 13.1.1 并且第一次使用turborepo配置基于 monoRepo 的项目。 and I want to use我想用
without the above config everything works perfectly没有上述配置一切正常
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
poweredByHeader: false,
compress: true,
transpilePackages: ['ui']
}
module.exports = nextConfig
but if I use below code但是如果我使用下面的代码
module.exports = withNextPwa(withBundleAnalyzer(
withSentryConfig({
nextConfig,
sentryWebpackPluginOptions,
})
));
getting error出现错误
../../packages/ui/components/Button.tsx
Module parse failed: Unexpected token (4:28)
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
import { ButtonProps } from "../type";
|
> export const Button = (props:ButtonProps) => {
| return <button>{props.label}</button>
| }
Import trace for requested module:
../../packages/ui/components/Button.tsx
../../packages/ui/index.tsx
./src/components/home/hero.tsx
./src/components/home/index.tsx
I have already spent more than one day to solve this but no-luck.我已经花了一天多的时间来解决这个问题,但没有运气。 any suggestion or guidance is welcome thanks in advance欢迎任何建议或指导提前致谢
I dont know why, but when I add transpilePackages even empty, it works:我不知道为什么,但是当我添加 transpilePackages 甚至是空的时,它起作用了:
...
transpilePackages: []
...
Some bug?一些错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.