jarvis
jarvis copied to clipboard
How to use it with react-scripts?
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 }) ]
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: https://github.com/facebook/create-react-app/issues/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.
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.
Aside from that, there's also React-App-Rewired, which might help you, adding Webpack and Babel things without ejecting.
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.