A
A
Alex2019-08-19 13:14:48
JavaScript
Alex, 2019-08-19 13:14:48

How to determine the current entry point?

There are several entry points in a Webpack project:

entry: {
  entry1: './src/entry1.ts',
  entry2: './src/entry2.ts',
  entry3: './src/entry3.ts',
},

And there is a helper function that is used in all. In all, it performs the same task. But on entry3 it should be slightly different. How in the body of the function to determine for which entry it is currently used? Maybe webpack creates some kind of special environment variable, or maybe you can specify such a variable yourself separately for each entry?
function helper () {
  // ... code
  if (ENTRY_NAME === 'entry3') { // <- Вот как проверить что функция обрабатывается в контексте entry3?
    // ... code
  }
}

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