使用Lerna时似乎无法在开发(next dev
)中运行NextJs。我可以将其他文件拉入(例如图像),但似乎无法使用此方法即时处理TS。有人对此有任何想法吗?
ModuleParseError: Module parse failed: The keyword 'interface' is reserved (3:0)
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 React from "react";
|
> interface Props {
| name: string;
| }
packages / shared / components / Example.tsx
import React from "react";
interface Props {
name: string;
}
export const Example = ({ name }: Props) => {
return <div>Name: {name}</div>;
};
packages / web / pages / index.tsx
import { Example } from "shared/components/Example";
答案 0 :(得分:1)
这是something that is being worked on/considered,应该是might actually work already in some cases,但是我无法让baseUrl
为我工作。
与此同时,per Jacob Rask's suggestion应该使用next-transpile-modules。我本人正在为这个问题而苦苦挣扎,并且终于奏效了!