mirror of
https://github.com/facebook/react.git
synced 2026-02-24 20:53:03 +00:00
## Summary `@rollup/plugin-typescript` emits a warning while building, hinting that `outputToFilesystem` defaults to true. Although "noEmit" is set to `true` for the tsconfig, rollup writes a `dist/.tsbuildinfo`. That file is then also shipped inside the npm module and doesn't offer any benefit for library consumers. Setting this option to false results in the file not being written and thus omitted from the npm module. ## How did you test this change? `dist/.tsbuildinfo` is not emitted any more.
72 lines
1.6 KiB
JavaScript
72 lines
1.6 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 terser from '@rollup/plugin-terser';
|
|
import prettier from 'rollup-plugin-prettier';
|
|
import banner2 from 'rollup-plugin-banner2';
|
|
|
|
const NO_INLINE = new Set(['@babel/types']);
|
|
|
|
const DEV_ROLLUP_CONFIG = {
|
|
input: 'src/index.ts',
|
|
output: {
|
|
file: 'dist/index.js',
|
|
format: 'cjs',
|
|
sourcemap: false,
|
|
exports: 'named',
|
|
},
|
|
plugins: [
|
|
typescript({
|
|
tsconfig: './tsconfig.json',
|
|
outputToFilesystem: true,
|
|
compilerOptions: {
|
|
noEmit: true,
|
|
},
|
|
}),
|
|
json(),
|
|
nodeResolve({
|
|
preferBuiltins: true,
|
|
resolveOnly: module => NO_INLINE.has(module) === false,
|
|
rootDir: path.join(process.cwd(), '..'),
|
|
}),
|
|
commonjs(),
|
|
terser({
|
|
format: {
|
|
comments: false,
|
|
},
|
|
compress: false,
|
|
mangle: false,
|
|
}),
|
|
prettier(),
|
|
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";
|
|
`
|
|
),
|
|
],
|
|
};
|
|
|
|
export default DEV_ROLLUP_CONFIG;
|