File tree Expand file tree Collapse file tree 8 files changed +55
-4
lines changed
crates/rspack_core/src/compiler/make/cutout
packages/rspack-test-tools
tests/watchCases/compilation/remove-module Expand file tree Collapse file tree 8 files changed +55
-4
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,9 @@ impl Cutout {
73
73
if module. depends_on ( & files) {
74
74
// add module id
75
75
force_build_modules. insert ( module. identifier ( ) ) ;
76
- // process parent module id
76
+ // process module dependencies
77
77
for connect in module_graph. get_incoming_connections ( & module. identifier ( ) ) {
78
- if let Some ( original_module_identifier) = connect. original_module_identifier {
79
- force_build_modules. insert ( original_module_identifier) ;
80
- }
78
+ force_build_deps. insert ( connect. dependency_id ) ;
81
79
}
82
80
}
83
81
}
Original file line number Diff line number Diff line change @@ -340,6 +340,8 @@ export class WatchStepProcessor<
340
340
resolve ( stats ) ;
341
341
} ) ;
342
342
} ) ;
343
+ // wait compiler to ready watch the files and diretories
344
+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
343
345
copyDiff (
344
346
path . join ( context . getSource ( ) , this . _watchOptions . stepName ) ,
345
347
this . _watchOptions . tempDir ,
Original file line number Diff line number Diff line change
1
+ import ( "./foo.js" ) . catch ( ( ) => {
2
+
3
+ } ) ;
Original file line number Diff line number Diff line change
1
+ module . exports = [
2
+ / M o d u l e n o t f o u n d : C a n ' t r e s o l v e /
3
+ ]
Original file line number Diff line number Diff line change
1
+ DELETE
Original file line number Diff line number Diff line change
1
+ module . exports = function ( source ) {
2
+ this . _module . buildInfo . timestamp = Date . now ( ) ;
3
+ return source ;
4
+ }
Original file line number Diff line number Diff line change
1
+ const path = require ( "path" ) ;
2
+
3
+ class Plugin {
4
+ apply ( compiler ) {
5
+ const moduleMap = new Map ( ) ;
6
+
7
+ compiler . hooks . compilation . tap ( "PLUGIN" , compilation => {
8
+ compilation . hooks . finishModules . tap ( "PLUGIN" , modules => {
9
+ for ( const module of modules ) {
10
+ if ( moduleMap . has ( module . resource ) ) {
11
+ const timestamp = moduleMap . get ( module . resource ) ;
12
+ // index.js only run loader by once.
13
+ expect ( module . buildInfo . timestamp ) . toBe ( timestamp ) ;
14
+ } else {
15
+ moduleMap . set ( module . resource , module . buildInfo . timestamp ) ;
16
+ }
17
+ }
18
+ } ) ;
19
+ } ) ;
20
+ }
21
+ }
22
+
23
+ module . exports = {
24
+ plugins : [
25
+ new Plugin ( )
26
+ ] ,
27
+ module : {
28
+ rules : [
29
+ {
30
+ test : / \. j s $ / ,
31
+ use : [
32
+ {
33
+ loader : path . join ( __dirname , "loader.js" ) ,
34
+ }
35
+ ]
36
+ }
37
+ ]
38
+ }
39
+ } ;
40
+
You can’t perform that action at this time.
0 commit comments