File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ module.exports = (env, argv) => {
2121 development [ 'devtool' ] = 'eval-source-map' ;
2222 }
2323
24+ // Resolve the directories for the react-sdk and js-sdk for later use. We resolve these early so we
25+ // don't have to call them over and over. We also resolve to the package.json instead of the src
26+ // directory so we don't have to rely on a index.js or similar file existing.
27+ const reactSdkSrcDir = path . resolve ( path . join ( require . resolve ( "matrix-react-sdk/package.json" ) , '..' , 'src' ) ) ;
28+ const jsSdkSrcDir = path . resolve ( path . join ( require . resolve ( "matrix-js-sdk/package.json" ) , '..' , 'src' ) ) ;
29+
2430 return {
2531 ...development ,
2632
@@ -117,8 +123,8 @@ module.exports = (env, argv) => {
117123 // run them through babel. Because the path tested is the resolved, absolute
118124 // path, these could be anywhere thanks to yarn link. We must also not
119125 // include node modules inside these modules, so we add 'src'.
120- if ( f . includes ( path . join ( 'matrix-js-sdk' , 'src' ) ) ) return true ;
121- if ( f . includes ( path . join ( 'matrix-react-sdk' , 'src' ) ) ) return true ;
126+ if ( f . startsWith ( reactSdkSrcDir ) ) return true ;
127+ if ( f . startsWith ( jsSdkSrcDir ) ) return true ;
122128
123129 // but we can't run all of our dependencies through babel (many of them still
124130 // use module.exports which breaks if babel injects an 'include' for its
You can’t perform that action at this time.
0 commit comments