File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ const path = require('path');
48
48
const stringEscaper = require ( './utils/string-escaper' ) ;
49
49
const crypto = require ( 'crypto' ) ;
50
50
const logger = require ( './logger' ) ;
51
+ const os = require ( 'os' ) ;
51
52
52
53
class ConfigGenerator {
53
54
/**
@@ -131,14 +132,19 @@ class ConfigGenerator {
131
132
*
132
133
* See shared-entry-concat-plugin.js for more details.
133
134
*/
134
- const tmpFileObject = tmp . fileSync ( ) ;
135
+ const staticHashKey = crypto
136
+ . createHash ( 'md4' )
137
+ . update ( this . webpackConfig . outputPath )
138
+ . digest ( 'hex' )
139
+ . slice ( 0 , 8 ) ;
140
+ const tmpFilename = path . join ( os . tmpdir ( ) , '_webpack_encore_tmp_module' + staticHashKey + '.js' ) ;
135
141
const pathToRequire = path . resolve ( this . webpackConfig . getContext ( ) , this . webpackConfig . sharedCommonsEntryFile ) ;
136
142
fs . writeFileSync (
137
- tmpFileObject . name ,
143
+ tmpFilename ,
138
144
`require('${ stringEscaper ( pathToRequire ) } ')`
139
145
) ;
140
146
141
- entry [ sharedEntryTmpName ] = tmpFileObject . name ;
147
+ entry [ sharedEntryTmpName ] = tmpFilename ;
142
148
}
143
149
144
150
if ( this . webpackConfig . copyFilesConfigs . length > 0 ) {
Original file line number Diff line number Diff line change 9
9
10
10
'use strict' ;
11
11
12
- const fs = require ( 'fs' ) ;
13
12
const sharedEntryTmpName = require ( '../utils/sharedEntryTmpName' ) ;
14
13
const RawSource = require ( 'webpack-sources/lib/RawSource' ) ;
15
14
You can’t perform that action at this time.
0 commit comments