Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix webpack to babel js-sdk & react-sdk but no other deps #11947

Merged
merged 1 commit into from
Jan 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,23 @@ module.exports = (env, argv) => {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
include: (f) => {
// we use the original source files of react-sdk and js-sdk, so we need to
// run them through babel.
if (f.startsWith(path.resolve(__dirname, 'node_modules', 'matrix-js-sdk'))) return true;
if (f.startsWith(path.resolve(__dirname, 'node_modules', 'matrix-react-sdk'))) return true;
// but we can't run all of our dependencies through babel (many of them still
// use module.exports which breaks if babel injects an 'include' for its
// polyfills: probably fixable but babeling all our dependencies is probably
// not necessary anyway).
if (f.startsWith(path.resolve(__dirname, 'node_modules'))) return false;
// anything else gets babeled (our own source files, and also modules that
// are yarn linked from somewhere else because this tests the absolute,
// resolved path, so react-sdk and js-sdk fall under this case in a standard
// dev setup. This will presumably start running any other module through
// babel if yarn linked... caveat emptor.
return true;
},
loader: 'babel-loader',
options: {
cacheDirectory: true
Expand Down