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

How to use it with react-scripts? #87

Open
gauravmakkar opened this issue Jan 22, 2018 · 4 comments
Open

How to use it with react-scripts? #87

gauravmakkar opened this issue Jan 22, 2018 · 4 comments
Labels

Comments

@gauravmakkar
Copy link

How to use it with react-scripts where you don't necessarily have the config file?

const Jarvis = require('webpack-jarvis');

/* the rest of your webpack configs */

plugins: [
new Jarvis({
port: 1337 // optional: set a port
})
]

@TimoStaudinger
Copy link
Contributor

TimoStaudinger commented Jan 22, 2018

Create-react-app, or their internal set of scripts provided by react-scripts currently does not support adding additional webpack plugins. Check out this issue for a reasoning why: facebook/create-react-app#99.

If you want to use it, you will have to eject, which gives you the full breath of config options. Note that this is a non-reversible option.

@zouhir
Copy link
Owner

zouhir commented Jan 23, 2018

I am not very experienced in CRA but @timosta sound correct.

CRA seem to not allow webpack plugins by default and you have to "eject" to add your own plugins.

@cpannwitz
Copy link

Aside from that, there's also React-App-Rewired, which might help you, adding Webpack and Babel things without ejecting.

@elquimista
Copy link

I already have been using react-app-rewired for a while, and tried to use this with webpack config overridden, but hitting localhost:1337 explodes.

/Volumes/313/Amt_4/031_knocknock/Manager AF/manager-af-web/node_modules/serve-static/index.js:121
      next()
      ^

TypeError: next is not a function
    at SendStream.error (/Volumes/313/Amt_4/031_knocknock/Manager AF/manager-af-web/node_modules/serve-static/index.js:121:7)
    at SendStream.emit (events.js:159:13)
    at SendStream.error (/Volumes/313/Amt_4/031_knocknock/Manager AF/manager-af-web/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/Volumes/313/Amt_4/031_knocknock/Manager AF/manager-af-web/node_modules/send/index.js:421:12)
    at onstat (/Volumes/313/Amt_4/031_knocknock/Manager AF/manager-af-web/node_modules/send/index.js:727:26)
    at FSReqWrap.oncomplete (fs.js:166:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

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

No branches or pull requests

5 participants