Skip to content

🎥 Make videos programmatically with React

further reduce size

Jonny Burger14d5bdd158bb
diff --git a/packages/player-example/.eslintrc b/packages/player-example/.eslintrc
index 9ec5ca74c5..298627eb8f 100644
--- a/packages/player-example/.eslintrc
+++ b/packages/player-example/.eslintrc
@@ -1,3 +1,6 @@
{
- "extends": "@remotion"
+ "extends": "@remotion",
+ "env": {
+ "node": true
+ }
}
diff --git a/packages/player-example/config/webpack.config.js b/packages/player-example/config/webpack.config.js
index db0f874cf9..3f51b5adb5 100644
--- a/packages/player-example/config/webpack.config.js
+++ b/packages/player-example/config/webpack.config.js
@@ -3,19 +3,13 @@
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
-const resolve = require('resolve');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
-const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const paths = require('./paths');
const modules = require('./modules');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
-const ForkTsCheckerWebpackPlugin =
- process.env.TSC_COMPILE_ON_ERROR === 'true'
- ? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
- : require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
@@ -41,15 +35,13 @@ const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
const imageInlineSizeLimit = parseInt(
- process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
+ process.env.IMAGE_INLINE_SIZE_LIMIT || '10000',
+ 10
);
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
-// Get the path to the uncompiled service worker (if it exists).
-const swSrc = paths.swSrc;
-
const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
return false;
@@ -65,6 +57,7 @@ const hasJsxRuntime = (() => {
// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
+// eslint-disable-next-line complexity
module.exports = function (webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';
@@ -103,12 +96,6 @@ module.exports = function (webpackEnv) {
const shouldUseReactRefresh = env.FAST_REFRESH;
- // common function to get style loaders
- const getStyleLoaders = (cssOptions, preProcessor) => {
- const loaders = [].filter(Boolean);
- return loaders;
- };
-
return {
target: ['browserslist'],
// Webpack noise constrained to errors and warnings
@@ -139,7 +126,7 @@ module.exports = function (webpackEnv) {
? 'static/js/[name].[contenthash:8].chunk.js'
: isEnvDevelopment && 'static/js/[name].chunk.js',
assetModuleFilename: 'static/media/[name].[hash][ext]',
- // webpack uses `publicPath` to determine where the app is being served from.
+ // Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: paths.publicUrlOrPath,
@@ -219,13 +206,6 @@ module.exports = function (webpackEnv) {
module: {
strictExportPresence: true,
rules: [
- // Handle node_modules packages that contain sourcemaps
- shouldUseSourceMap && {
- enforce: 'pre',
- exclude: /@babel(?:\/|\\{1,2})runtime/,
- test: /\.(js|mjs|jsx|ts|tsx|css)$/,
- loader: require.resolve('source-map-loader'),
- },
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
@@ -337,31 +317,26 @@ module.exports = function (webpackEnv) {
},
plugins: [
// Generates an `index.html` file with the <script> injected.
- new HtmlWebpackPlugin(
- Object.assign(
- {},
- {
- inject: true,
- template: paths.appHtml,
- },
- isEnvProduction
- ? {
- minify: {
- removeComments: true,
- collapseWhitespace: true,
- removeRedundantAttributes: true,
- useShortDoctype: true,
- removeEmptyAttributes: true,
- removeStyleLinkTypeAttributes: true,
- keepClosingSlash: true,
- minifyJS: true,
- minifyCSS: true,
- minifyURLs: true,
- },
- }
- : undefined
- )
- ),
+ new HtmlWebpackPlugin({
+ inject: true,
+ template: paths.appHtml,
+ ...(isEnvProduction
+ ? {
+ minify: {
+ removeComments: true,
+ collapseWhitespace: true,
+ removeRedundantAttributes: true,
+ useShortDoctype: true,
+ removeEmptyAttributes: true,
+ removeStyleLinkTypeAttributes: true,
+ keepClosingSlash: true,
+ minifyJS: true,
+ minifyCSS: true,
+ minifyURLs: true,
+ },
+ }
+ : undefined),
+ }),
// Inlines the webpack runtime script. This script is too small to warrant
// a network request.
// https://github.com/facebook/create-react-app/issues/5358
diff --git a/packages/player-example/package.json b/packages/player-example/package.json
index de36871848..863293d091 100644
--- a/packages/player-example/package.json
+++ b/packages/player-example/package.json
@@ -30,9 +30,7 @@
"react-dom": "18.0.0",
"react-refresh": "^0.11.0",
"remotion": "2.6.15",
- "resolve": "^1.20.0",
"semver": "^7.3.5",
- "source-map-loader": "^3.0.0",
"typescript": "^4.5.5",
"webpack": "^5.64.4",
"webpack-dev-server": "^4.6.0"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e9ba9b1f46..fbf814b24e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -689,9 +689,7 @@ importers:
react-dom: 18.0.0
react-refresh: ^0.11.0
remotion: 2.6.15
- resolve: ^1.20.0
semver: ^7.3.5
- source-map-loader: ^3.0.0
typescript: ^4.5.5
webpack: ^5.64.4
webpack-dev-server: ^4.6.0
@@ -718,9 +716,7 @@ importers:
react-dom: [email protected]
react-refresh: 0.11.0
remotion: link:../core
- resolve: 1.22.0
semver: 7.3.5
- source-map-loader: [email protected]
typescript: 4.5.5
webpack: 5.72.0
webpack-dev-server: [email protected]
@@ -18391,18 +18387,6 @@ packages:
dev: false
- /source-map-loader/[email protected]:
- resolution: {integrity: sha512-GKGWqWvYr04M7tn8dryIWvb0s8YM41z82iQv01yBtIylgxax0CwvSy6gc2Y02iuXwEfGWRlMicH0nvms9UZphw==}
- engines: {node: '>= 12.13.0'}
- peerDependencies:
- webpack: ^5.0.0
- dependencies:
- abab: 2.0.5
- iconv-lite: 0.6.3
- source-map-js: 0.6.2
- webpack: 5.72.0
- dev: false
-
/source-map-resolve/0.5.3:
resolution: {integrity: sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==}
deprecated: See https://github.com/lydell/source-map-resolve#deprecated