Closed deadcoder0904 closed 6 years ago
I understand your question, unfortunately the only way to handle that is in your config \ NODE_ENV.
Jarvis works like any other plugin and runs once it exists in the plugins array in your webpack config file and they way you have done it is actually the right way, I don't know of any better idea but here are what we can do:
1- instead of passing JARVIS=true
you can rely if --watch
exist or not, and in your base configs you you can probably check of this is --watch
mode: https://stackoverflow.com/a/5767589
2- another option is, we can add disable option to Jarvis, but we still need a flag from you on when to disable it and it will end up very similar to what you have.
Please let me know if I can help further more!
Cool I thought there would be a better way though 😂
@zouhir might it make sense to only run Jarvis in watch mode by default? i.e. by booting it up in compiler.plugin("watch-run", ...)
, rather than where it sits atm in the root apply
?
Maybe worth considering with me https://github.com/zouhir/jarvis/pull/122 to make the option be something like options.onlyRunInWatchMode
(awful name, but you get my point) which defaults to true
? And then when sets to false
it will boot up Jarvis regardless of watch mode or not, and not close the server as soon as the build finishes?
I've raised https://github.com/zouhir/jarvis/pull/125 as a possible example of what I mean. Hopefully something like this could solve both this issue, and https://github.com/zouhir/jarvis/pull/122?
I believe that with 0.3.0 Jarvis should behave as described here
Unless the watchOnly
option is set to false, then Jarvis won't run when just running a non-watching build
So this ticket should be fine to close?
yep! can be closed!
Not sure if its a Webpack thing or JARVIS thing, but here it is.
Currently I'm using a environment variable
JARVIS
& to include it I use a booleantrue
Complete example is https://github.com/deadcoder0904/webpack-exam
So my questions is -
Is there any way I can refactor the line https://github.com/deadcoder0904/webpack-exam/blob/master/package.json#L8 to not send
JARVIS=true
as environment variable ? What I mean by this is if I am usingwebpack-dev-server
in the script usejarvis
& if I'm usingwebpack
in the script don't use it without using env variableJARVIS
.Also, I think
examples
might help this repo to make it better. Like simple example withdev
,prod
&base
config working withjarvis
& complex one working withexpress
, etc...I will be happy to contribute 😉