I’m on a quest to write a build plugin that includes/transpiles files with custom extension (say, .myspecialjs
) into javascript, but only when running in development/debug mode.
The reason for this is another package I wrote that’s debugOnly
, which will then be used by the code in these .myspecialjs
-files.
I don’t want these files to be included in the production build.
So far I’ve managed to build a package that’s marked debugOnly and another package that adds a build plugin that does exactly what I want, but…
For this to work, the first package must call api.imply('myBuildPlugin')
in the package.js
. This seems to cause the inclusion of my build plugin even when building a production bundle, which then causes errors when my .myspecialjs
-files try to import stuff from the debugOnly
package that didn’t get included.
I also tried to write a minifier plugin that would just remove those files, but then I would have to remove standard-minifier-js, since only one minifier is allowed (naturally).
I’m still trying different strategies, but if you have an idea, please share…
EDIT: On second read, this is really hard to understand. In a nutshell, what I want is to…
- A debugOnly-package that includes another package, a build plugin
- This build plugin will include specific files to the JS bundle but ONLY in debug/dev-mode