File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,7 +109,23 @@ module.exports = (env, argv) => {
109109 rules : [
110110 {
111111 test : / \. ( t s | j s ) x ? $ / ,
112- exclude : / n o d e _ m o d u l e s / ,
112+ include : ( f ) => {
113+ // we use the original source files of react-sdk and js-sdk, so we need to
114+ // run them through babel.
115+ if ( f . startsWith ( path . resolve ( __dirname , 'node_modules' , 'matrix-js-sdk' ) ) ) return true ;
116+ if ( f . startsWith ( path . resolve ( __dirname , 'node_modules' , 'matrix-react-sdk' ) ) ) return true ;
117+ // but we can't run all of our dependencies through babel (many of them still
118+ // use module.exports which breaks if babel injects an 'include' for its
119+ // polyfills: probably fixable but babeling all our dependencies is probably
120+ // not necessary anyway).
121+ if ( f . startsWith ( path . resolve ( __dirname , 'node_modules' ) ) ) return false ;
122+ // anything else gets babeled (our own source files, and also modules that
123+ // are yarn linked from somewhere else because this tests the absolute,
124+ // resolved path, so react-sdk and js-sdk fall under this case in a standard
125+ // dev setup. This will presumably start running any other module through
126+ // babel if yarn linked... caveat emptor.
127+ return true ;
128+ } ,
113129 loader : 'babel-loader' ,
114130 options : {
115131 cacheDirectory : true
You can’t perform that action at this time.
0 commit comments