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

feature request: build to a single file (inlined css and js) #6118

Closed
npomfret opened this issue Jan 3, 2019 · 6 comments
Closed

feature request: build to a single file (inlined css and js) #6118

npomfret opened this issue Jan 3, 2019 · 6 comments
Labels

Comments

@npomfret
Copy link

npomfret commented Jan 3, 2019

I'm trying to create a react app with all js and css files inlined into the index.html file (because I'm deploying to a weird environment where having multiple files is going to be a pain).

Can't figure it out at all. Anyone know of a detailed example out there?

@robertvansteen
Copy link
Contributor

That's not possible with create-react-app. You could eject and use something like: https://github.com/dustinjackson/html-webpack-inline-source-plugin.

@npomfret
Copy link
Author

npomfret commented Jan 4, 2019

@rovansteen thanks for the reply. I failed to get this working. I'm new to this stuff so am probably doing something wrong...

npx create-react-app my-app
cd my-app
yarn build

... all good so far.

yarn eject
rm -rf build && yarn build

yarn run v1.10.1
$ node scripts/build.js
Creating an optimized production build...
Failed to compile.

./src/index.js
Error: [BABEL] <...>/my-app/src/index.js: Cannot find module '@babel/plugin-transform-react-jsx' (While processing: "/Users/nickpomfret/projects/react-test/my-app/node_modules/babel-preset-react-app/index.js$1")
    at Array.reduce (<anonymous>)

I can get eject to work. At least not as I was expecting.

@robertvansteen
Copy link
Contributor

Yes, unfortunately ejecting seems to be broken right now. See: #6099

@npomfret
Copy link
Author

npomfret commented Jan 4, 2019

I got it working: DustinJackson/html-webpack-inline-source-plugin#59

Being able to create a react app in a single file as a command line build option would be a nice feature.

@npomfret npomfret changed the title how to create a react app in a single html file feature request: build to a single file (inlined css and js) Jan 4, 2019
@stale
Copy link

stale bot commented Feb 7, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Feb 7, 2019
@stale
Copy link

stale bot commented Feb 12, 2019

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Feb 12, 2019
@lock lock bot locked and limited conversation to collaborators Feb 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants