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

Preserve ESM for async imports to work correctly #4187

Merged
merged 9 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
22 changes: 0 additions & 22 deletions .babelrc

This file was deleted.

25 changes: 25 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
sourceMaps: true,
presets: [
[
"@babel/preset-env",
{
targets: {
esmodules: true,
},
// Used "commonjs" for tests due to https://github.com/matrix-org/matrix-js-sdk/pull/4187#issuecomment-2117342908
// and "false" to preserve ESM for the final build to make async
// imports work correctly.
ms-dosx86 marked this conversation as resolved.
Show resolved Hide resolved
modules: process.env.NODE_ENV === "test" ? "commonjs" : false,
richvdh marked this conversation as resolved.
Show resolved Hide resolved
},
],
"@babel/preset-typescript",
],
plugins: [
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime",
],
};
2 changes: 1 addition & 1 deletion src/models/MSC3089TreeSpace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { ISendEventResponse } from "../@types/requests";
import { FileType } from "../http-api";
import { KnownMembership } from "../@types/membership";
import { RoomPowerLevelsEventContent, SpaceChildEventContent } from "../@types/state_events";
import { EncryptedFile, FileContent } from "../@types/media";
import type { EncryptedFile, FileContent } from "../@types/media";

/**
* The recommended defaults for a tree space's power levels. Note that this
Expand Down