My Glitch Project keeps deleting index and css file when I edit my React files


#1

As I was editing my project, I was looking to be able to import/export React components in my project rather than have one giant React file. The Glitch react-starter did not allow me to do import/export so I used the webpack, webpack.config, and package.json from the React-Webpack-Babel Community Boilerplate.

Everything was working great! Until I was told to type “refresh” in the console and my index.html and style.css file got deleted! I coded them up again and my project was able to go live! But when I edited my react.jsx file, the project again deleted my index.html and style.css!

Can anyone tell me as to why this happens? The only code I put in the index.html is the basic <!Doctype> setup and the only thing I add is a link to bootstrap, my css file, and at the bottom of the <body> I link the bundle.js so everything from react is loaded into index.html.

I do not know how to properly use webpack, only just started using it and google all the code errors until all is fixed… So sorry if its a webpack newbie problem.


#2

I’m a new user, so was only able to post two links in the post…
Here is my project I am working on

I am remixing a previous project of mine, only tested import/export with title.jsx and react.jsx so far. After the second deletion of index/css files I decided not to create those files anymore.


#3

Welcome to the forum, @Neveon! It looks like the package.json file for your project is using the rimraf project to delete the contents of your public directory. You may want to adjust that to only delete the webpack bundle, or not delete files at all.

Hope that helps!