From 0fa82fa836b7e8a85afd334a7863c2f8f7090eb9 Mon Sep 17 00:00:00 2001 From: Duncan Murdoch Date: Wed, 20 Nov 2024 14:58:26 -0500 Subject: [PATCH] Document Roxygen issue with makeDependency --- man/makeDependency.Rd | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/man/makeDependency.Rd b/man/makeDependency.Rd index c66e56898..a0d4a667b 100644 --- a/man/makeDependency.Rd +++ b/man/makeDependency.Rd @@ -45,6 +45,24 @@ the minified file will be used in the dependency object, hints won't be given, and syntax errors will lead to an uninformative failure to minify. } +\note{ +The usual way to use \code{makeDependency} is +to call it in a \file{.R} file in a package, saving +the result in a variable that will be used when an +HTML widget is created. This way it is only run +during package installation, when it is safe to +write to the R library holding the package. + +Do not call it to write to the R library from +code the user can run, as that is not allowed in +general. + +If your package uses Roxygen, you may have problems +because by default Roxygen will run the code, and it +is likely to fail. The current workaround is to +specify Roxygen option \code{load = "installed"} +which prevents it from running your \file{.R} code. +} \value{ An object that can be included in a list of dependencies passed to \code{htmltools::\link[htmltools:htmlDependencies]{attachDependencies}}. }