Skip to content

πŸŽ₯ Make videos programmatically with React

`@remotion/bundler`: Expose css-loader entrypoint, update tailwind packages

Jonny Burgerb5439f9843c3
diff --git a/bun.lock b/bun.lock
index 71be1faf93..2c98449c6b 100644
--- a/bun.lock
+++ b/bun.lock
@@ -1525,7 +1525,6 @@
"version": "4.0.438",
"dependencies": {
"autoprefixer": "10.4.20",
- "css-loader": "5.2.7",
"postcss": "8.4.47",
"postcss-loader": "^7.3.0",
"postcss-preset-env": "^8.3.2",
@@ -1548,7 +1547,6 @@
"version": "4.0.438",
"dependencies": {
"@tailwindcss/webpack": "4.2.0",
- "css-loader": "5.2.7",
"style-loader": "4.0.0",
"tailwindcss": "4.2.0",
},
diff --git a/packages/bundler/package.json b/packages/bundler/package.json
index 0b70a45816..f47c2f8886 100644
--- a/packages/bundler/package.json
+++ b/packages/bundler/package.json
@@ -54,6 +54,11 @@
"webpack",
"player"
],
+ "exports": {
+ ".": "./dist/index.js",
+ "./css-loader": "./css-loader/index.js",
+ "./package.json": "./package.json"
+ },
"publishConfig": {
"access": "public"
},
diff --git a/packages/example/src/CssLoaderTest/base.css b/packages/example/src/CssLoaderTest/base.css
new file mode 100644
index 0000000000..f780251c81
--- /dev/null
+++ b/packages/example/src/CssLoaderTest/base.css
@@ -0,0 +1,76 @@
+/* Test: basic CSS rules, selectors, pseudo-classes */
+.css-loader-test {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ font-family: sans-serif;
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
+ color: white;
+ padding: 40px;
+ box-sizing: border-box;
+}
+
+.css-loader-test h2 {
+ font-size: 32px;
+ margin: 0 0 20px 0;
+}
+
+/* Test: multiple selectors */
+.card,
+.url-card {
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 12px;
+ padding: 20px;
+ margin: 8px;
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+/* Test: pseudo-classes and pseudo-elements */
+.card::before {
+ content: 'βœ“ ';
+ color: #4ade80;
+}
+
+.card:first-child {
+ border-left: 3px solid #4ade80;
+}
+
+/* Test: @media queries */
+@media (min-width: 0px) {
+ .media-query-test {
+ color: #4ade80;
+ font-weight: bold;
+ }
+}
+
+/* Test: CSS custom properties (variables) */
+:root {
+ --test-accent: #e94560;
+ --test-radius: 8px;
+}
+
+.uses-vars {
+ color: var(--test-accent);
+ border-radius: var(--test-radius);
+}
+
+/* Test: CSS animations */
+@keyframes pulse {
+ 0% {
+ opacity: 0.6;
+ }
+ 50% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0.6;
+ }
+}
+
+.animated {
+ animation: pulse 2s ease-in-out infinite;
+}
diff --git a/packages/example/src/CssLoaderTest/imported.css b/packages/example/src/CssLoaderTest/imported.css
new file mode 100644
index 0000000000..77ebd626c5
--- /dev/null
+++ b/packages/example/src/CssLoaderTest/imported.css
@@ -0,0 +1,5 @@
+/* Test: @import handling β€” this file is imported by another CSS file */
+.imported-style {
+ font-style: italic;
+ color: #a78bfa;
+}
diff --git a/packages/example/src/CssLoaderTest/index.tsx b/packages/example/src/CssLoaderTest/index.tsx
new file mode 100644
index 0000000000..2ee8d4145c
--- /dev/null
+++ b/packages/example/src/CssLoaderTest/index.tsx
@@ -0,0 +1,36 @@
+import {AbsoluteFill} from 'remotion';
+import './base.css';
+import './with-import.css';
+import './with-url.css';
+
+export const CssLoaderTest: React.FC = () => {
+ return (
+ <AbsoluteFill>
+ <div className="css-loader-test">
+ <h2>CSS Loader Testbed</h2>
+
+ {/* Test 1: Basic CSS rules */}
+ <div className="card">Basic CSS rules work</div>
+
+ {/* Test 2: @media query */}
+ <div className="card media-query-test">@media query works</div>
+
+ {/* Test 3: CSS custom properties */}
+ <div className="card uses-vars">CSS variables work</div>
+
+ {/* Test 4: CSS animation */}
+ <div className="card animated">CSS animation works</div>
+
+ {/* Test 5: @import */}
+ <div className="card has-import imported-style">
+ @import works (should be italic + purple)
+ </div>
+
+ {/* Test 6: url() */}
+ <div className="card url-card bg-image">
+ url() works (background image above)
+ </div>
+ </div>
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/example/src/CssLoaderTest/with-import.css b/packages/example/src/CssLoaderTest/with-import.css
new file mode 100644
index 0000000000..5fdc6b04f1
--- /dev/null
+++ b/packages/example/src/CssLoaderTest/with-import.css
@@ -0,0 +1,7 @@
+/* Test: @import at-rule β€” css-loader should resolve this */
+@import './imported.css';
+
+.has-import {
+ text-decoration: underline;
+ text-underline-offset: 4px;
+}
diff --git a/packages/example/src/CssLoaderTest/with-url.css b/packages/example/src/CssLoaderTest/with-url.css
new file mode 100644
index 0000000000..fc94e229b4
--- /dev/null
+++ b/packages/example/src/CssLoaderTest/with-url.css
@@ -0,0 +1,8 @@
+/* Test: url() handling β€” css-loader should resolve these asset references */
+.bg-image {
+ background-image: url('../../public/nested/mp4.png');
+ background-size: 64px 64px;
+ background-repeat: no-repeat;
+ background-position: center;
+ min-height: 80px;
+}
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index 43d6f4452f..74f7868fd8 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -21,6 +21,7 @@ import {ColorInterpolation} from './ColorInterpolation';
import {ComplexSounds} from './ComplexSounds';
import {MyCtx, WrappedInContext} from './Context';
import CorruptVideo from './CorruptVideo';
+import {CssLoaderTest} from './CssLoaderTest';
import {DarkModeTest} from './DarkModeTest';
import {DecoderDemo} from './DecoderDemo';
import {DynamicDuration, dynamicDurationSchema} from './DynamicDuration';
@@ -669,6 +670,14 @@ export const Index: React.FC = () => {
fps={30}
durationInFrames={2}
/>
+ <Composition
+ id="css-loader-test"
+ component={CssLoaderTest}
+ width={1080}
+ height={1080}
+ fps={30}
+ durationInFrames={90}
+ />
<Composition
id="react-svg"
component={ReactSvg}
diff --git a/packages/tailwind-v4/package.json b/packages/tailwind-v4/package.json
index f29d5e3ec6..62cb36c43a 100644
--- a/packages/tailwind-v4/package.json
+++ b/packages/tailwind-v4/package.json
@@ -20,7 +20,6 @@
"url": "https://github.com/remotion-dev/remotion/issues"
},
"dependencies": {
- "css-loader": "5.2.7",
"style-loader": "4.0.0",
"tailwindcss": "4.2.0",
"@tailwindcss/webpack": "4.2.0"
diff --git a/packages/tailwind-v4/src/enable.ts b/packages/tailwind-v4/src/enable.ts
index 50a391cd84..144be0ff16 100644
--- a/packages/tailwind-v4/src/enable.ts
+++ b/packages/tailwind-v4/src/enable.ts
@@ -23,7 +23,7 @@ export const enableTailwind: (
test: /\.css$/i,
use: [
require.resolve('style-loader'),
- require.resolve('css-loader'),
+ require.resolve('@remotion/bundler/css-loader'),
require.resolve('@tailwindcss/webpack'),
],
},
diff --git a/packages/tailwind/package.json b/packages/tailwind/package.json
index b738174cce..56f7c17083 100644
--- a/packages/tailwind/package.json
+++ b/packages/tailwind/package.json
@@ -21,7 +21,6 @@
},
"dependencies": {
"autoprefixer": "10.4.20",
- "css-loader": "5.2.7",
"postcss": "8.4.47",
"postcss-loader": "^7.3.0",
"postcss-preset-env": "^8.3.2",
diff --git a/packages/tailwind/src/enable.ts b/packages/tailwind/src/enable.ts
index ffc57cb530..fe44c04975 100644
--- a/packages/tailwind/src/enable.ts
+++ b/packages/tailwind/src/enable.ts
@@ -26,7 +26,7 @@ export const enableTailwind: (
test: /\.css$/i,
use: [
require.resolve('style-loader'),
- require.resolve('css-loader'),
+ require.resolve('@remotion/bundler/css-loader'),
{
loader: require.resolve('postcss-loader'),
options: {