[英]Does Codesandbox,io remove the public directory from REACT apps & Why does it work without it?
I have been working with codesandbox.io and react and updating github from codesandbox.我一直在使用codesandbox.io 并从codesandbox 做出反应和更新github。 Today I tried to pull it down locally onto my machine (and install it) and work on it and realized two things.
今天我试图将它本地拉到我的机器上(并安装它)并在它上面工作并实现了两件事。
So I have 2 questions 1. Does codesandbox.io remove the public directory or was it me?所以我有 2 个问题 1. codesandbox.io 是删除公共目录还是我? 2. If it was me why does my app still work in codesandbox.io
2.如果是我,为什么我的应用程序仍然在codeandbox中运行。io
My Codesandbox is here https://codesandbox.io/s/wiki-mogpb?fontsize=14&hidenavigation=1&theme=dark我的 Codesandbox 在这里https://codesandbox.io/s/wiki-mogpb?fontsize=14&hidenavigation=1&theme=dark
It seems when you not providing an entry point, codesandbox adding a root
element for you, in any case the one that removed the file is you and you should provide one in your standalone application.似乎当您不提供入口点时,codesandbox 会为您添加
root
元素,无论如何删除文件的是您,您应该在独立应用程序中提供一个。
ReactDOM.render(<App />, document.getElementById('root'));
I was being stupid!我是愚蠢的!
Looks like I moved the public directory into my CSS folder and it was rendering from there successfully.看起来我将公共目录移到了我的 CSS 文件夹中,并且从那里成功渲染。
Thats probably why its not working when i pull it down.这可能就是为什么当我把它拉下来时它不工作的原因。 Sounds like codesandbox is finding the file regardless of where it is!
听起来codesandbox正在寻找文件,无论它在哪里!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.