webpack_ (Chapter II) _ On webpack packaged content output

On webpack packaged knowledge
to complete the basic configuration webpack after the last
run npm run bundlepackage
can be seen in our package when the output command a lot of tips, information that output What does it mean?
Here Insert Picture Description
1.Hash: corresponds to this package only Hash value
2.Version: using Webpack version
3.Time: The current package this whole package takes
4.Asset: Here are a index.js documents means that we index.js packed out a file, Size means that this file has 1.06KiB, 5.Chunks means: now we just packed out a file, sometimes when we do a complex package, will pack a lot of files each file will have its own id value, Chunts placed more than just yourself this file corresponds to the id value, it is also possible index.js and some other js files are related in large-scale projects, then packed out other files js file id are also placed in Chunks
6.Chunks name refers to: Chunks id is placed inside each js file, Chunks names are placed js file name corresponding to each.
In fact, we have followed the string entry in the configuration file is actually a main short
Here Insert Picture Description
Here Insert Picture Description
so Chunks Name of the entry name that is arranged inside the name
7. The main Entrypoint = The index.js: show the entire packaging process in which a file entry , will then be packaged, first of all packaging index.js, which will be used header.js. Packaging completion
8. WARNING in configguration Warning: when webpack configuration, not specified packaged or packaged environment model
In webpack.config.js file:

module.exports = {
  mode: "production",  // 模式默认是 production,就不会出现警告了
  entry: {
    main: "./src/index.js"
  }
}

When the mode is set to production time, then packed the files will be compressed, if the mode is set to developent, packed generated files are not compressed.

Published 137 original articles · won praise 30 · views 260 000 +

Guess you like

Origin blog.csdn.net/hani_wen/article/details/93088731