Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在另一个文件夹中设置下一个文件夹?_Javascript_Reactjs_Next.js - Fatal编程技术网

Javascript 如何在另一个文件夹中设置下一个文件夹?

Javascript 如何在另一个文件夹中设置下一个文件夹?,javascript,reactjs,next.js,Javascript,Reactjs,Next.js,我的pages文件夹位于/client文件夹中,并且希望在项目根目录中找到.next文件夹 我有一个具有以下结构的项目: 我将pages文件夹放在./client/pages下。理想情况下,我想把.next文件夹放在项目的根目录中 可以这样做吗?您可以使用next.config.js文件指定生成的输出 我喜欢把我的文件夹命名为_next,这样可以更方便地进行路由 module.exports = { distDir: '_next', }; 因此,您可以使用以下命令使路径在目录中遍历一级

我的pages文件夹位于/client文件夹中,并且希望在项目根目录中找到.next文件夹

我有一个具有以下结构的项目:

我将pages文件夹放在./client/pages下。理想情况下,我想把.next文件夹放在项目的根目录中


可以这样做吗?

您可以使用next.config.js文件指定生成的输出

我喜欢把我的文件夹命名为_next,这样可以更方便地进行路由

module.exports = {
  distDir: '_next',
};
因此,您可以使用以下命令使路径在目录中遍历一级:

module.exports = {
  distDir: '../.next',
};
虽然我建议您不要使用.next名称,而是使用下划线,但这将解决生产中的许多难题

module.exports = {
  distDir: '../_next',
};
更好的解决方案是使用类似Nginx的代理为您处理路由。因此,将您的_下一个文件夹保留在客户机目录中,并将根路径设置为您的客户机文件夹