File tree Expand file tree Collapse file tree
mpp-core/webpack.config.d Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,29 +28,25 @@ config.module = config.module || {};
2828config . module . unknownContextCritical = false ;
2929config . module . exprContextCritical = false ;
3030
31- // Add webpack plugin to ignore wasm-git's dynamic requires
32- const webpack = require ( 'webpack' ) ;
33- config . plugins . push (
34- new webpack . ContextReplacementPlugin (
35- / w a s m - g i t / ,
36- ( data ) => {
37- // Ignore all dynamic requires in wasm-git
38- delete data . dependencies [ 0 ] . critical ;
39- return data ;
40- }
41- )
42- ) ;
31+ config . plugins = config . plugins || [ ] ;
4332
44- // Ignore specific problematic requires in wasm-git
45- config . plugins . push (
46- new webpack . IgnorePlugin ( {
47- resourceRegExp : / ^ \. \/ $ / ,
48- contextRegExp : / w a s m - g i t /
49- } )
50- ) ;
33+ config . plugins . push ( {
34+ apply ( compiler ) {
35+ const normalModuleFactory = compiler && compiler . hooks && compiler . hooks . normalModuleFactory ;
36+ if ( ! normalModuleFactory ) return ;
37+
38+ normalModuleFactory . tap ( 'AutoDevIgnoreWasmGitDynamicRequire' , ( factory ) => {
39+ factory . hooks . beforeResolve . tap ( 'AutoDevIgnoreWasmGitDynamicRequire' , ( request ) => {
40+ if ( request && / w a s m - g i t / . test ( request . context || '' ) && request . request === './' ) {
41+ return false ;
42+ }
43+ return undefined ;
44+ } ) ;
45+ } ) ;
46+ }
47+ } ) ;
5148
5249// Copy tree-sitter.wasm and language WASM files to the output directory
53- config . plugins = config . plugins || [ ] ;
5450config . plugins . push (
5551 new CopyWebpackPlugin ( {
5652 patterns : [
Original file line number Diff line number Diff line change @@ -28,29 +28,25 @@ config.module = config.module || {};
2828config . module . unknownContextCritical = false ;
2929config . module . exprContextCritical = false ;
3030
31- // Add webpack plugin to ignore wasm-git's dynamic requires
32- const webpack = require ( 'webpack' ) ;
33- config . plugins . push (
34- new webpack . ContextReplacementPlugin (
35- / w a s m - g i t / ,
36- ( data ) => {
37- // Ignore all dynamic requires in wasm-git
38- delete data . dependencies [ 0 ] . critical ;
39- return data ;
40- }
41- )
42- ) ;
31+ config . plugins = config . plugins || [ ] ;
4332
44- // Ignore specific problematic requires in wasm-git
45- config . plugins . push (
46- new webpack . IgnorePlugin ( {
47- resourceRegExp : / ^ \. \/ $ / ,
48- contextRegExp : / w a s m - g i t /
49- } )
50- ) ;
33+ config . plugins . push ( {
34+ apply ( compiler ) {
35+ const normalModuleFactory = compiler && compiler . hooks && compiler . hooks . normalModuleFactory ;
36+ if ( ! normalModuleFactory ) return ;
37+
38+ normalModuleFactory . tap ( 'AutoDevIgnoreWasmGitDynamicRequire' , ( factory ) => {
39+ factory . hooks . beforeResolve . tap ( 'AutoDevIgnoreWasmGitDynamicRequire' , ( request ) => {
40+ if ( request && / w a s m - g i t / . test ( request . context || '' ) && request . request === './' ) {
41+ return false ;
42+ }
43+ return undefined ;
44+ } ) ;
45+ } ) ;
46+ }
47+ } ) ;
5148
5249// Copy tree-sitter.wasm and language WASM files to the output directory
53- config . plugins = config . plugins || [ ] ;
5450config . plugins . push (
5551 new CopyWebpackPlugin ( {
5652 patterns : [
You can’t perform that action at this time.
0 commit comments