mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 00:20:28 +01:00
## Summary This fixes a minor nit I have about the `react-compiler-runtime` package in that the published code is minified. I assume most consumers will minify their own bundles so there's no real advantage to minifying it as part of the build. For my purposes it makes it more difficult to read the code, use `patch-package` (if needed), or diff two versions without referencing the source code on github or mapping it back to original source using the source maps. ## How did you test this change? I ran the build locally and looked at the result but did not run the code. It's a lot more readable except for the commonjs compatibility-related stuff that Rollup inserts.
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import typescript from '@rollup/plugin-typescript';
|
|
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
import json from '@rollup/plugin-json';
|
|
import path from 'path';
|
|
import process from 'process';
|
|
import banner2 from 'rollup-plugin-banner2';
|
|
|
|
const NO_INLINE = new Set(['react']);
|
|
|
|
const PROD_ROLLUP_CONFIG = {
|
|
input: 'src/index.ts',
|
|
output: {
|
|
file: 'dist/index.js',
|
|
format: 'cjs',
|
|
sourcemap: true,
|
|
},
|
|
plugins: [
|
|
typescript({
|
|
tsconfig: './tsconfig.json',
|
|
compilerOptions: {
|
|
noEmit: true,
|
|
},
|
|
}),
|
|
json(),
|
|
nodeResolve({
|
|
preferBuiltins: true,
|
|
resolveOnly: module => NO_INLINE.has(module) === false,
|
|
rootDir: path.join(process.cwd(), '..'),
|
|
}),
|
|
commonjs(),
|
|
banner2(
|
|
() => `/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @lightSyntaxTransform
|
|
* @noflow
|
|
* @nolint
|
|
* @preventMunge
|
|
* @preserve-invariant-messages
|
|
*/
|
|
|
|
"use no memo";` // DO NOT REMOVE
|
|
),
|
|
],
|
|
};
|
|
|
|
export default PROD_ROLLUP_CONFIG;
|