为了在第一次请求Next.js应用程序时减少要加载的脚本数量,我希望避免只有一个通用上下文/上下文提供程序,并且有一些本地上下文管理状态是先验不存在的。
例如,让主上下文管理树的/home部分中的状态。
我想,它必须放置在/home,但不知道树可以在哪里包装。
-| pages
|-| _app.js //where the global state lives
|-| index.js //root of Next.js app
|-| home //where the local state should live ?
|-|-| news.js
我已经在我的next.js应用程序中安装了node-sass,并尝试通过在_app.js组件中导入‘../style/style.scss’;来导入我的全局scss文件,但是我得到了这个错误:
Global CSS cannot be imported from files other than your Custom <App>. Please move all global CSS imports to pages\_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: ht
我正在尝试在next.js react项目中使用tone.js。当我运行或构建时,我得到了这个错误:"ReferenceError: AudioBuffer is not defined“ 我已经将tone.js代码隔离在codesandbox中,它工作得很好。https://codesandbox.io/s/tonejs-react-pink-noise-generator-pfnl0?file=/src/App.js 但不在next.js应用程序中 ReferenceError: AudioBuffer is not defined
at ki (/node_module