【发布时间】:2019-07-20 14:33:22
【问题描述】:
我正在尝试使用 ReasonReact 在我的 Nextjs 应用程序中实现 React Context API,但被 bucklescript 编译器推断模块名称的方式所吸引。
为了使整个树都可以使用上下文,我需要从 Nextjs App 组件继承。问题是 Next 按照惯例将 pages/_app.js 用于 App 组件继承,但是当我使用 _app.re 作为文件名时,bsb 不会生成名为“App”的 Reason 模块。
事实上,bsb 打印以下消息并忽略该文件:
IGNORED: file _app.re under pages is ignored because it can't be turned into a valid module name. The build system transforms a file name into a module name by upper-casing the first letter
有没有办法告诉 Nextjs 在别处寻找 App 组件?或者也许是一种方法来调整 bsb 只为这个文件?
最后一个似乎有点远,但我不想涉足 JavaScript,除非我真的必须这样做。
【问题讨论】:
标签: reactjs next.js react-context reason-react bsb