Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create dev/index.html during development (using npm start -s) #588

Open
ohenrik opened this issue Sep 28, 2018 · 5 comments
Open

Create dev/index.html during development (using npm start -s) #588

ohenrik opened this issue Sep 28, 2018 · 5 comments

Comments

@ohenrik
Copy link

ohenrik commented Sep 28, 2018

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.

@coryhouse
Copy link
Owner

coryhouse commented Sep 28, 2018

If you need physical files, then why not just run the prod build: npm run build?

@ohenrik
Copy link
Author

ohenrik commented Oct 1, 2018

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.

@coryhouse
Copy link
Owner

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)

@nickytonline
Copy link
Collaborator

nickytonline commented Oct 1, 2018

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.

@ohenrik
Copy link
Author

ohenrik commented Oct 2, 2018

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 :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants