I found no examples for gulp-load-plugins
in TypeScript. Unfortunately,
my TypeScript is too poor to understand, what should to do from @type/gulp-load-plugins
comments.
I tried:
import * as _gulpPlugins from 'gulp-load-plugins';
const gulpPlugins: IGulpPlugins = _gulpPlugins();
return gulp.src(sourceFilesGlobSelections)
.pipe(gulpPlugins.pug())
// ...
It makes 4 warnings from Webpack (I dont understand where number such 75:13-25
refers; .pipe(gulpPlugins.pug())
is on 50 row):
WARNING in ../node_modules/gulp-load-plugins/index.js 75:13-25
Critical dependency: the request of a dependency is an expression
@ ./TaskManagers/MarkupPreprocessingHelper.ts
WARNING in ../node_modules/gulp-load-plugins/index.js 81:48-63
Critical dependency: the request of a dependency is an expression
@ ./TaskManagers/MarkupPreprocessingHelper.ts
WARNING in ../node_modules/gulp-load-plugins/index.js 117:40-55
Critical dependency: the request of a dependency is an expression
@ ./TaskManagers/MarkupPreprocessingHelper.ts
WARNING in ../node_modules/gulp-load-plugins/index.js 122:51-66
Critical dependency: the request of a dependency is an expression
@ ./TaskManagers/MarkupPreprocessingHelper.ts
It was told in @types/gulp-load-plugins
:
/**
* Extend this interface to use Gulp plugins in your gulpfile.js
*/
interface IGulpPlugins {
}
I tried:
interface IGulpPlugins {
pug: () => NodeJS.ReadWriteStream;
}
It also defined:
declare module 'gulp-load-plugins' {
interface IOptions {
// ...
}
interface IPluginNameMappings {
[npmPackageName: string]: string
}
/** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */
function gulpLoadPlugins<T extends IGulpPlugins>(options?: IOptions): T;
// ...
}
It looks like maybe I should use gulpLoadPlugins
instead of interface extending ...
Is is all that I understand with my current TypeScirpt proficiency, but it not enough to understand how to use gulp-load-plugins
in TypeScript.
There is the working example in gulp-load-plugins-tests.ts:
About
Critical dependency: the request of a dependency is an expression
: do not bundle Node.js dependencies for the webpack projects those target is Node.js (not browser). webpack-node-externals will tell webpack do not bundle Node.js libraries, however it's still possible to import and use them as usual.