react-slingshot
react-slingshot copied to clipboard
Create dev/index.html during development (using `npm start -s`)
I'm about to go crazy due to this magic:
output: {
path: path.resolve(__dirname, 'dist'), // Note: Physical files are only output by the production build task `npm run build`.
publicPath: '/',
filename: 'bundle.js'
},
More specifically this:
// Note: Physical files are only output by the production build task npm run build
So the question is, how do I make webpack create physical files in dev/
? I need this to be able to serve my application through Flask (python) during development as well as production.
If you need physical files, then why not just run the prod build: npm run build
?
This would not work with hot reloading during development, right? I seem to remember it being possible to host the files through something like django/flask while still running the webpack solution through npm.
Correct. No hot reloading on prod build. I'd recommend finding a way to run your React app all by itself so you can use npm start
. (likely by hitting mock data)
If you really wanted to persist files and have hot reloading in dev mode, you could use a webpack plugin like write-file-webpack-plugin. Obviously out of the scope of react-slingshot, but leaving it here for you if you want to try it out.
I've used it in the past while building a Chrome extension in React. Found it super handy.
Thank you @nickytonline I'll give that a try, it looks like what i need :)
@coryhouse the problem is that i want to test out an authentication logic that uses cookies created by flask-dance for google auth. This cookie is created automatically on the domain of the flask app, so i need to serve the react app from the same domain to be able to access the cookie (i think).
However I'm searching for other ways to do the login process, if you have any tips on this related to flask and/or React using Google login, let me know :))