mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[react-devtools-cdt-mcp] Make it esm-only package (#36973)
The package was CJS-only, now adding basic ESM package exports to make sure it works there as well.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./dist/index.js');
|
||||
@@ -3,16 +3,23 @@
|
||||
"version": "0.0.0",
|
||||
"description": "Integration of React tools with chrome-devtools-mcp",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./register": "./dist/register.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./src/register.js",
|
||||
"./dist/register.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/react.git",
|
||||
"directory": "packages/react-devtools-cdt-mcp"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"index.js",
|
||||
"register.js"
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "cross-env NODE_ENV=production rollup -c rollup.config.cjs",
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./dist/register.js');
|
||||
@@ -32,14 +32,12 @@ const plugins = [
|
||||
}),
|
||||
];
|
||||
|
||||
function createBundle(input, file) {
|
||||
function createBundle(input, name) {
|
||||
return {
|
||||
input,
|
||||
// CommonJS bundles for the npm package (referenced by root stubs).
|
||||
output: {
|
||||
file,
|
||||
format: 'cjs',
|
||||
exports: 'named',
|
||||
file: `dist/${name}.js`,
|
||||
format: 'es',
|
||||
},
|
||||
treeshake: {moduleSideEffects: false},
|
||||
plugins,
|
||||
@@ -47,6 +45,6 @@ function createBundle(input, file) {
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
createBundle('src/index.js', 'dist/index.js'),
|
||||
createBundle('src/register.js', 'dist/register.js'),
|
||||
createBundle('src/index.js', 'index'),
|
||||
createBundle('src/register.js', 'register'),
|
||||
];
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
export * from './DevToolsCdtMcp';
|
||||
export * from './DevToolsCdtMcp.js';
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import {register} from './DevToolsCdtMcp';
|
||||
import {register} from './DevToolsCdtMcp.js';
|
||||
|
||||
// Side effect: install the facade (before React) and register the React tool
|
||||
// group for chrome-devtools-mcp. Import this module before React.
|
||||
@@ -26,4 +26,4 @@ if (
|
||||
);
|
||||
}
|
||||
|
||||
export * from './DevToolsCdtMcp';
|
||||
export * from './DevToolsCdtMcp.js';
|
||||
|
||||
Reference in New Issue
Block a user