Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sandpack-react): build ReactDevTools component #833

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions sandpack-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"prebuild": "yarn run clean",
"test": "TEST_ENV=true jest . --transformIgnorePatterns \"node_modules/(?!@codemirror)/\" --modulePathIgnorePatterns \"e2e\"",
"lint": "eslint '**/*.ts?(x)' --fix",
"build": "rollup -c && yarn build:types",
"build:types": "tsc -p tsconfig.json",
"build": "rollup -c --bundleConfigAsCjs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're making this very same change on #798

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to contribute there too

"build:publish": "yarn build",
"start": "tsc -p tsconfig.esm.json --watch",
"dev": "start-storybook -p 6006 --quiet",
Expand Down
26 changes: 15 additions & 11 deletions sandpack-react/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const commonjs = require("@rollup/plugin-commonjs");
const replace = require("@rollup/plugin-replace");
const typescript = require("@rollup/plugin-typescript");
import { relative } from "path";

const pkg = require("./package.json");
import commonjs from "@rollup/plugin-commonjs";
import replace from "@rollup/plugin-replace";
import typescript from "@rollup/plugin-typescript";

import pkg from "./package.json";

const configBase = {
input: "src/index.ts",
output: [
{
file: pkg.main,
dir: "dist",
entryFileNames: relative("dist", pkg.main),
exports: "named",
format: "cjs",
inlineDynamicImports: true,
interop: "auto",
},
{
file: pkg.module,
dir: "dist",
entryFileNames: relative("dist", pkg.module),
exports: "named",
format: "es",
inlineDynamicImports: true,
},
],

plugins: [
typescript({ tsconfig: "./tsconfig.json" }),
typescript({
tsconfig: "./tsconfig.json",
}),
replace({
preventAssignment: true,
values: { "process.env.TEST_ENV": "false" },
Expand All @@ -33,10 +37,10 @@ const configBase = {
],
external: [
"react/jsx-runtime",
/react-devtools-inline/,
...Object.keys(pkg.dependencies),
...Object.keys(pkg.devDependencies),
...Object.keys(pkg.peerDependencies),
],
};

module.exports = configBase;
export default configBase;
1 change: 1 addition & 0 deletions sandpack-react/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from "./Preview";
export * from "./TranspiledCode";
export * from "./Tests";
export * from "./Console";
export * from "./ReactDevTools";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReactDevTools is not currently working, that's why it hasn't been exported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i miss that)