File tree Expand file tree Collapse file tree 5 files changed +23
-7
lines changed
packages/@vue/cli-service/lib Expand file tree Collapse file tree 5 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ module.exports = class Service {
297297 resovledFrom = 'inline options'
298298 }
299299
300- // normlaize some options
300+ // normalize some options
301301 if ( typeof resolved . baseUrl === 'string' ) {
302302 resolved . baseUrl = resolved . baseUrl . replace ( / ^ \. \/ / , '' )
303303 }
Original file line number Diff line number Diff line change @@ -82,7 +82,10 @@ module.exports = (api, options) => {
8282 . loader ( 'url-loader' )
8383 . options ( {
8484 limit : inlineLimit ,
85- name : getAssetPath ( options , `img/[name].[hash:8].[ext]` )
85+ name : getAssetPath (
86+ options ,
87+ `img/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
88+ )
8689 } )
8790
8891 // do not base64-inline SVGs.
@@ -93,7 +96,10 @@ module.exports = (api, options) => {
9396 . use ( 'file-loader' )
9497 . loader ( 'file-loader' )
9598 . options ( {
96- name : getAssetPath ( options , `img/[name].[hash:8].[ext]` )
99+ name : getAssetPath (
100+ options ,
101+ `img/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
102+ )
97103 } )
98104
99105 webpackConfig . module
@@ -103,7 +109,10 @@ module.exports = (api, options) => {
103109 . loader ( 'url-loader' )
104110 . options ( {
105111 limit : inlineLimit ,
106- name : getAssetPath ( options , `media/[name].[hash:8].[ext]` )
112+ name : getAssetPath (
113+ options ,
114+ `media/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
115+ )
107116 } )
108117
109118 webpackConfig . module
@@ -113,7 +122,10 @@ module.exports = (api, options) => {
113122 . loader ( 'url-loader' )
114123 . options ( {
115124 limit : inlineLimit ,
116- name : getAssetPath ( options , `fonts/[name].[hash:8].[ext]` )
125+ name : getAssetPath (
126+ options ,
127+ `fonts/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
128+ )
117129 } )
118130
119131 // Other common pre-processors ---------------------------------------------
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ module.exports = (api, options) => {
2525 const shouldExtract = isProd && extract !== false && ! shadowMode
2626 const filename = getAssetPath (
2727 options ,
28- `css/[name]. [contenthash:8].css` ,
28+ `css/[name]${ options . filenameHashing ? '. [contenthash:8]' : '' } .css` ,
2929 true /* placeAtRootIfRelative */
3030 )
3131 const extractOptions = Object . assign ( {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = (api, options) => {
55 const getAssetPath = require ( '../util/getAssetPath' )
66 const filename = getAssetPath (
77 options ,
8- `js/[name]${ isLegacyBundle ? `-legacy` : `` } . [chunkhash:8].js`
8+ `js/[name]${ isLegacyBundle ? `-legacy` : `` } ${ options . filenameHashing ? '. [chunkhash:8]' : '' } .js`
99 )
1010
1111 webpackConfig
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const { createSchema, validate } = require('@vue/cli-shared-utils')
33const schema = createSchema ( joi => joi . object ( {
44 baseUrl : joi . string ( ) . allow ( '' ) ,
55 outputDir : joi . string ( ) ,
6+ filenameHashing : joi . boolean ( ) ,
67 assetsDir : joi . string ( ) ,
78 indexPath : joi . string ( ) ,
89 runtimeCompiler : joi . boolean ( ) ,
@@ -53,6 +54,9 @@ exports.defaults = () => ({
5354 // where to output built files
5455 outputDir : 'dist' ,
5556
57+ // whether filename will contain hash part
58+ filenameHashing : true ,
59+
5660 // where to put static assets (js/css/img/font/...)
5761 assetsDir : '' ,
5862
You can’t perform that action at this time.
0 commit comments