mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Bundle babel-plugin-react-forget with rollup
Attempt to bundle the plugin with rollup instead of just tsc. I'm intentionally not inlining babel related modules, as we should ideally rely on the host environment's version instead
This commit is contained in:
1 parent
473237ba1f
commit
419310cd15
3 files changed
+34
-3
No files matched your search
@@ -8,7 +8,7 @@
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rimraf dist && tsc",
|
||||
"build": "rimraf dist && rollup --config --bundleConfigAsCjs",
|
||||
"test": "concurrently -g -n snap,sprout \"yarn snap:ci\" \"yarn sprout:ci\"",
|
||||
"jest": "tsc && ts-node \"$(yarn --silent which jest)\"",
|
||||
"snap": "node ../snap/dist/main.js",
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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";
|
||||
|
||||
const NO_INLINE = new Set(["@babel/generator", "@babel/types"]);
|
||||
|
||||
export default {
|
||||
input: "src/index.ts",
|
||||
output: {
|
||||
file: "dist/index.js",
|
||||
format: "cjs",
|
||||
sourcemap: false,
|
||||
exports: "named",
|
||||
},
|
||||
plugins: [
|
||||
typescript({
|
||||
compilerOptions: {
|
||||
noEmit: true,
|
||||
},
|
||||
}),
|
||||
json(),
|
||||
nodeResolve({
|
||||
preferBuiltins: true,
|
||||
resolveOnly: (module) => NO_INLINE.has(module) === false,
|
||||
rootDir: path.join(process.cwd(), ".."),
|
||||
}),
|
||||
commonjs(),
|
||||
],
|
||||
};
|
||||
@@ -16,8 +16,7 @@
|
||||
"target": "ES2015",
|
||||
// ideally turn off only during dev, or on a per-file basis
|
||||
"noUnusedLocals": false,
|
||||
"sourceMap": true,
|
||||
"composite": true
|
||||
"composite": true,
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
||||
Reference in new issue
Block a user