webpack some of the concepts of configuration items and configuration

__dirname is a global variable in nodejs, it refers to an absolute path of the current execution of the code; 

configured to generate the index.html path, and it references the resource path, and a path where the resource referenced:
index: path.resolve (__ dirname, '../dist/index.html'), the index.html // generated on a path of the current directory path dist
assetsRoot: path.resolve (__ dirname, '../dist') // output resource file in the dist directory of the current directory on stage
assetsSubDirectory: './static/', // index from resources outside of the package to the current static directory dist
assetsPublicPath: './hello/' // representatives index.hmtl generated files, which introduced resource, in front of the path to add  ./hello/, that is assetsPublicPath的值 



index.html webpack compiled in reference to the relationship between resource path assetsRoot, assetsSubDirectory, assetsPublicPath of

the figure, as the path generated by a combination of static resources and assetsSubDirectory assetRoot made, i.e. patch.resolve (_dirname, '.. / dist / static1 / static1 / static2')
↓↓↓↓↓

 

 

Generated as above configuration index.html

 

Wherein the front half of the path by adding assetsSubDirectory composition assetsPublicPath

 

 

Determining the path of the first general configuration index, and static path set storage location, final adjustment of the position reference assetsPublicPath

 

 

 

 

 








Guess you like

Origin www.cnblogs.com/ClaudiaYan/p/11506828.html