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');
4848const stringEscaper = require ( './utils/string-escaper' ) ;
4949const crypto = require ( 'crypto' ) ;
5050const logger = require ( './logger' ) ;
51+ const os = require ( 'os' ) ;
5152
5253class ConfigGenerator {
5354 /**
@@ -131,14 +132,19 @@ class ConfigGenerator {
131132 *
132133 * See shared-entry-concat-plugin.js for more details.
133134 */
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' ) ;
135141 const pathToRequire = path . resolve ( this . webpackConfig . getContext ( ) , this . webpackConfig . sharedCommonsEntryFile ) ;
136142 fs . writeFileSync (
137- tmpFileObject . name ,
143+ tmpFilename ,
138144 `require('${ stringEscaper ( pathToRequire ) } ')`
139145 ) ;
140146
141- entry [ sharedEntryTmpName ] = tmpFileObject . name ;
147+ entry [ sharedEntryTmpName ] = tmpFilename ;
142148 }
143149
144150 if ( this . webpackConfig . copyFilesConfigs . length > 0 ) {
Original file line number Diff line number Diff line change 99
1010'use strict' ;
1111
12- const fs = require ( 'fs' ) ;
1312const sharedEntryTmpName = require ( '../utils/sharedEntryTmpName' ) ;
1413const RawSource = require ( 'webpack-sources/lib/RawSource' ) ;
1514
You can’t perform that action at this time.
0 commit comments