File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/@vue/cli-service/lib Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -135,14 +135,22 @@ class PluginAPI {
135135 const fs = require ( 'fs' )
136136 const cacheDirectory = this . resolve ( `node_modules/.cache/${ id } ` )
137137
138+ // replace \r\n to \n generate consistent hash
139+ const fmtFunc = conf => {
140+ if ( typeof conf === 'function' ) {
141+ return conf . toString ( ) . replace ( / \r \n ? / g, '\n' )
142+ }
143+ return conf
144+ }
145+
138146 const variables = {
139147 partialIdentifier,
140148 'cli-service' : require ( '../package.json' ) . version ,
141149 'cache-loader' : require ( 'cache-loader/package.json' ) . version ,
142150 env : process . env ,
143151 config : [
144- this . service . projectOptions . chainWebpack ,
145- this . service . projectOptions . configureWebpack
152+ fmtFunc ( this . service . projectOptions . chainWebpack ) ,
153+ fmtFunc ( this . service . projectOptions . configureWebpack )
146154 ]
147155 }
148156
@@ -159,7 +167,7 @@ class PluginAPI {
159167 for ( const file of configFiles ) {
160168 const content = readConfig ( file )
161169 if ( content ) {
162- variables . configFiles = content
170+ variables . configFiles = content . replace ( / \r \n ? / g , '\n' )
163171 break
164172 }
165173 }
You can’t perform that action at this time.
0 commit comments