@@ -5,6 +5,13 @@ module.exports = (api, options) => {
55 const getAssetPath = require ( '../util/getAssetPath' )
66 const inlineLimit = 4096
77
8+ const genAssetSubPath = dir => {
9+ return getAssetPath (
10+ options ,
11+ `${ dir } /[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
12+ )
13+ }
14+
815 webpackConfig
916 . mode ( 'development' )
1017 . context ( api . service . context )
@@ -82,10 +89,7 @@ module.exports = (api, options) => {
8289 . loader ( 'url-loader' )
8390 . options ( {
8491 limit : inlineLimit ,
85- name : getAssetPath (
86- options ,
87- `img/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
88- )
92+ name : genAssetSubPath ( 'img' )
8993 } )
9094
9195 // do not base64-inline SVGs.
@@ -96,10 +100,7 @@ module.exports = (api, options) => {
96100 . use ( 'file-loader' )
97101 . loader ( 'file-loader' )
98102 . options ( {
99- name : getAssetPath (
100- options ,
101- `img/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
102- )
103+ name : genAssetSubPath ( 'img' )
103104 } )
104105
105106 webpackConfig . module
@@ -109,10 +110,7 @@ module.exports = (api, options) => {
109110 . loader ( 'url-loader' )
110111 . options ( {
111112 limit : inlineLimit ,
112- name : getAssetPath (
113- options ,
114- `media/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
115- )
113+ name : genAssetSubPath ( 'media' )
116114 } )
117115
118116 webpackConfig . module
@@ -122,10 +120,7 @@ module.exports = (api, options) => {
122120 . loader ( 'url-loader' )
123121 . options ( {
124122 limit : inlineLimit ,
125- name : getAssetPath (
126- options ,
127- `fonts/[name]${ options . filenameHashing ? '.[hash:8]' : '' } .[ext]`
128- )
123+ name : genAssetSubPath ( 'fonts' )
129124 } )
130125
131126 // Other common pre-processors ---------------------------------------------
0 commit comments