How to pass some data to the next webpack loader

I am trying to write some chained downloaders for the BEM methodology . Here is part of the webpack configuration.

  entry: './src/pages/index.bemjson.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
   rules: [
     {
         test: /\.bemjson\.js$/,
         loader: 'bh-loader!bemdeps-loader!bemdecl-loader!bemjson-loader'
     }
   ]

The result of the first bootloader (bemjson-loader), which is required later in other bootloaders (bemdecl-loader and bh-loader).

What is the correct way to transfer data through such a bootloader?

The documentation says that boot loaders should be simple (prefer this binding to one complex boot loader). It seems that I need to use " value ". But it is out of date.

+4
source share

Source: https://habr.com/ru/post/1675497/


All Articles