-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Feature request
What is the expected behavior?
The behavior of entry is array should be described more specifically
What is motivation or use case for adding/changing the behavior?
When the user sees the document, it should be clear how to use it and what the usage scenario is.
How should this be implemented in your opinion?
I think the document should be like this:
Array Syntax
module.exports = {
entry: {
main: ['react', 'react-dom']
}
};What happens when you pass an array to entry? Passing an array of file paths to the entry property creates what is known as a "multi-main entry". This is useful when you would like to inject multiple dependent files together and graph their dependencies into one "chunk".
another usage scenario is when you want inject a pollyfill or some special code, you can use array entry instead of import by hand.
example 1:
module.exports = {
entry: {
// have not to do `import('@babel/polyfill')` in entry.js file
main: ['@babel/polyfill', './entry.js']
}
};example 2:
Common development environment configuration
module.exports = {
entry: {
// inject hot reload code
main: ['webpack-dev-server/client?https://localhost:8080/', 'webpack/hot/dev-server', './entry.js']
}
};Are you willing to work on this yourself?
yes, but i do not good at english very well, i need help😄
