@@ -62,12 +62,12 @@ function getPackages() {
62
62
Object . assign ( mem , { [ curr . replace ( / \. j s $ / , '' ) ] : curr } ) ,
63
63
{ } ,
64
64
) ,
65
- ...( pkg . name === 'jest-circus' ? { './runner' : './runner.js' } : { } ) ,
65
+ ...( pkg . name === 'jest-circus' ? { './runner' : './build/ runner.js' } : { } ) ,
66
66
...( pkg . name === 'expect'
67
67
? { './build/matchers' : './build/matchers.js' }
68
68
: { } ) ,
69
69
...( pkg . name === 'pretty-format'
70
- ? { './ConvertAnsi' : './build/plugins/ ConvertAnsi.js' }
70
+ ? { './ConvertAnsi' : './build/ConvertAnsi.js' }
71
71
: { } ) ,
72
72
} ,
73
73
`Package "${ pkg . name } " does not export correct files` ,
@@ -163,7 +163,7 @@ function createWebpackConfigs() {
163
163
} ) ;
164
164
}
165
165
166
- const extraEntries =
166
+ const workerEntriesEntries =
167
167
pkg . name === 'jest-worker'
168
168
? {
169
169
processChild : path . resolve (
@@ -183,14 +183,38 @@ function createWebpackConfigs() {
183
183
? { testWorker : path . resolve ( packageDir , './src/testWorker.ts' ) }
184
184
: { } ;
185
185
186
+ const extraEntryPoints =
187
+ // skip expect for now
188
+ pkg . name === 'expect'
189
+ ? { }
190
+ : Object . keys ( pkg . exports )
191
+ . filter (
192
+ key =>
193
+ key !== '.' &&
194
+ key !== './package.json' &&
195
+ ! key . startsWith ( './bin' ) ,
196
+ )
197
+ . reduce ( ( previousValue , currentValue ) => {
198
+ return {
199
+ ...previousValue ,
200
+ // skip `./`
201
+ [ currentValue . slice ( 2 ) ] : path . resolve (
202
+ packageDir ,
203
+ './src' ,
204
+ `${ currentValue } .ts` ,
205
+ ) ,
206
+ } ;
207
+ } , { } ) ;
208
+
186
209
return {
187
210
packageDir,
188
211
pkg,
189
212
webpackConfig : {
190
213
devtool : false ,
191
214
entry : {
192
215
index : input ,
193
- ...extraEntries ,
216
+ ...workerEntriesEntries ,
217
+ ...extraEntryPoints ,
194
218
} ,
195
219
externals : nodeExternals ( ) ,
196
220
mode : 'production' ,
@@ -212,7 +236,7 @@ function createWebpackConfigs() {
212
236
} ,
213
237
path : path . resolve ( packageDir , 'build' ) ,
214
238
} ,
215
- plugins : [ new IgnoreDynamicRequire ( extraEntries ) ] ,
239
+ plugins : [ new IgnoreDynamicRequire ( workerEntriesEntries ) ] ,
216
240
resolve : {
217
241
extensions : [ '.ts' , '.js' ] ,
218
242
} ,
0 commit comments