N
N
Nik17122020-11-05 19:24:14
webpack
Nik1712, 2020-11-05 19:24:14

How to set webpack output path to write to existing directories on multiple entry points?

There is approximately such a config (I give a fragment)

const config = {
  entry: {
    '/green/': ['./green/theme-green/js/src/index.js', './green/theme-green/less/style.less'],
    '/red/': ['./red/theme-red/js/src/index.js', './red/theme-red/scss/main.scss']
  },
  output: {
    path: path.join(__dirname, '/dest/'),
    assetModuleFilename: 'assets/[hash][ext]',
    filename: '[name]combine.js',
    publicPath: ''
  },
  module: { 
  // 
  }
}


In addition, there are green and red folders in the root (with sources)
How to set up paths in the path to write to them (according to the entry point, for green - green / dest / ... and for red - red / dest / ... )

To be more precise: how to get the name of the entry point in path?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question