placeholder-loader
webpack loader
Replace placeholder in source with value returned by handler
Parameters
source
string
Examples
// Loader options have been passed as an object// *** in webpack.config.js *** { consoledirarguments colors: true depth: null; consoledirthis colors: true depth: null; // Do something}; const webpackConfig = module: rules: test: /\.$/ use: loader: 'placeholder-loader' options: placeholder: 'any_string_here' handler // Loader options have been passed as a query string// In case option `handler` is a string, loader looking for a file with appropriate name and 'require' it'.// *** handler.js ***module { // Do something} // *** in webpack.config.js ***const webpackConfig = module: rules: test: /\.$/ use: 'placeholder-loader?placeholder=any_string_here&handler=handlerPath' // Usage with the vue-loaderconst webpackConfig = module: rules: test: /\.vue$/ use: loader: 'vue-loader' options : preLoaders: js: 'placeholder-loader?placeholder=any_string_here&handler=handlerPath'
Returns string source with placeholder replaced by value returned by handler
placeholder
string placed in source