Closed lindsayplatt closed 6 years ago
@lindsaycarr so currently we need to add each js file to the viz.yaml for this to work?
Yes, and I don't know if there is a way to get around it unless we can figure out how to get --watch
to work with vizmake...but that gets complicated because webpack would need to be looking at changes in the js/___.js
files. My solution here was to make it so that we didn't need to think about the structure behind the scenes.
Did you try the having run webpack first in the vizmake so it creates the bundle.js and then vizmake can just put the newly recreated bundle.js into the target folder. Or does that not even register as a change in the file to vizmake?
I think we actually talked about my above comment before, we don't want webpack running each time only just when it has to right?
Well, we still would need to have those js files as targets and then dependencies of whatever kicked off the webpack build. I opted for webpack to do all of file organization and configuration file stuff "behind the scenes" in target/
I'm lossed when it comes to the guts of what makes vizmake() run, so I'll trust your judgment. Maybe Alison has more constructive things to say whenever she gets back. ((✊)) Travis Build!!
Looks like some of the Travis issues are directly related to this PR:
* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'generateWebpackConfigFile':
generateWebpackConfigFile
Code: function(file, webpack.config)
Docs: function(webpack.config)
Argument names in code not in docs:
file
Mismatches in argument names:
Position: 1 Code: file Docs: webpack.config
* checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'checkInstalled'
‘name’
Undocumented arguments in documentation object 'generateWebpackConfigFile'
‘webpack.config’
Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter ���Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
^ yeah, some errors seem to be because I didn't have Generate documentation with Roxygen
checked in my build config...I will push up some commits soon and see what happens.
Changes based on @aappling-usgs and @lindsaycarr meeting:
--watch
and one doesn'tnpm run __
every time vizmake() is called (potentially look into https://www.npmjs.com/package/only-if-changed-webpack-plugin if this starts taking a long time to re-run every time)package.json
and webpack.config.js
We are still missing how the bundled js file in target now ends up as a script tag in the body of the index.html....
Ooh, good point. We'll need that script tag. The publish step could be responsible for just exactly that, though, and no file movements. And it could get run before the webpack call within vizmake().
Add the ability to use webpack. If the
webpack
section (https://github.com/USGS-VIZLAB/vizlab/pull/385/files#diff-0cb220d0e9525edb2082cae497231423R255) is not defined, it will skip all of this. Related to work going on over in https://github.com/USGS-VIZLAB/gage-conditions/issues/10Even with making each
.js
a target, changes are not triggering a rebuild.