[英]next js with Turborepo ui package import through error: You may need an appropriate loader
我正在使用 next.js 13.1.1 並且第一次使用turborepo配置基於 monoRepo 的項目。 我想用
沒有上述配置一切正常
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
poweredByHeader: false,
compress: true,
transpilePackages: ['ui']
}
module.exports = nextConfig
但是如果我使用下面的代碼
module.exports = withNextPwa(withBundleAnalyzer(
withSentryConfig({
nextConfig,
sentryWebpackPluginOptions,
})
));
出現錯誤
../../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
我已經花了一天多的時間來解決這個問題,但沒有運氣。 歡迎任何建議或指導提前致謝
我不知道為什么,但是當我添加 transpilePackages 甚至是空的時,它起作用了:
...
transpilePackages: []
...
一些錯誤?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.