Skip to content

🎥 Make videos programmatically with React

fix lambda when not using typescript

Jonny Burger9328ea3c80a7
diff --git a/packages/bundler/src/esbuild-loader/index.ts b/packages/bundler/src/esbuild-loader/index.ts
index 6b49c4c2ff..642046d16c 100644
--- a/packages/bundler/src/esbuild-loader/index.ts
+++ b/packages/bundler/src/esbuild-loader/index.ts
@@ -1,6 +1,5 @@
import path from 'path';
import {transform as defaultEsbuildTransform} from 'esbuild';
-import typescript from 'typescript';
import webpack from 'webpack';
import {LoaderOptions} from './interfaces';
@@ -8,6 +7,15 @@ const tsConfigPath = path.join(process.cwd(), 'tsconfig.json');
const isTsExtensionPtrn = /\.ts$/i;
+const isTypescriptInstalled = () => {
+ try {
+ require.resolve('typescript');
+ return true;
+ } catch (err) {
+ return false;
+ }
+};
+
async function ESBuildLoader(
this: webpack.LoaderContext<LoaderOptions>,
source: string
@@ -36,7 +44,8 @@ async function ESBuildLoader(
sourcefile: this.resourcePath,
};
- if (!('tsconfigRaw' in transformOptions)) {
+ if (!('tsconfigRaw' in transformOptions) && isTypescriptInstalled()) {
+ const typescript = require('typescript') as typeof import('typescript');
const tsConfig = typescript.readConfigFile(
tsConfigPath,
typescript.sys.readFile
diff --git a/packages/lambda/remotionlambda.zip b/packages/lambda/remotionlambda.zip
index a48f71b93f..7a90e376ec 100644
Binary files a/packages/lambda/remotionlambda.zip and b/packages/lambda/remotionlambda.zip differ