mirror of
https://github.com/facebook/react.git
synced 2026-02-25 13:13:03 +00:00
## Summary Our toy webpack plugin for Server Components is pretty broken right now because, now that `.client.js` convention is gone, it ends up adding every single JS file it can find (including `node_modules`) as a potential async dependency. Instead, it should only look for files with the `'use client'` directive. The ideal way is to implement this by bundling the RSC graph first. Then, we would know which `'use client'` files were actually discovered — and so there would be no point to scanning the disk for them. That's how Next.js bundler does it. We're not doing that here. This toy plugin is very simple, and I'm not planning to do heavy lifting. I'm just bringing it up to date with the convention. The change is that we now read every file we discover (alas), bail if it has no `'use client'`, and parse it if it does (to verify it's actually used as a directive). I've changed to use `acorn-loose` because it's forgiving of JSX (and likely TypeScript/Flow). Otherwise, this wouldn't work on uncompiled source. ## Test plan Verified I can get our initial Server Components Demo running after this change. Previously, it would get stuck compiling and then emit thousands of errors. Also confirmed the fixture still works. (It doesn’t work correctly on the first load after dev server starts, but that’s already the case on main so seems unrelated.)
97 lines
2.6 KiB
JSON
97 lines
2.6 KiB
JSON
{
|
|
"name": "react-server-dom-webpack",
|
|
"description": "React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
|
|
"version": "18.2.0",
|
|
"keywords": [
|
|
"react"
|
|
],
|
|
"homepage": "https://reactjs.org/",
|
|
"bugs": "https://github.com/facebook/react/issues",
|
|
"license": "MIT",
|
|
"files": [
|
|
"LICENSE",
|
|
"README.md",
|
|
"index.js",
|
|
"plugin.js",
|
|
"client.js",
|
|
"client.browser.js",
|
|
"client.edge.js",
|
|
"client.node.js",
|
|
"client.node.unbundled.js",
|
|
"server.js",
|
|
"server.browser.js",
|
|
"server.edge.js",
|
|
"server.node.js",
|
|
"server.node.unbundled.js",
|
|
"node-register.js",
|
|
"cjs/",
|
|
"umd/",
|
|
"esm/"
|
|
],
|
|
"exports": {
|
|
".": "./index.js",
|
|
"./plugin": "./plugin.js",
|
|
"./client": {
|
|
"workerd": "./client.edge.js",
|
|
"edge-light": "./client.edge.js",
|
|
"deno": "./client.edge.js",
|
|
"worker": "./client.edge.js",
|
|
"node": {
|
|
"webpack": "./client.node.js",
|
|
"default": "./client.node.unbundled.js"
|
|
},
|
|
"browser": "./client.browser.js",
|
|
"default": "./client.browser.js"
|
|
},
|
|
"./client.browser": "./client.browser.js",
|
|
"./client.edge": "./client.edge.js",
|
|
"./client.node": "./client.node.js",
|
|
"./client.node.unbundled": "./client.node.unbundled.js",
|
|
"./server": {
|
|
"react-server": {
|
|
"workerd": "./server.edge.js",
|
|
"edge-light": "./server.edge.js",
|
|
"deno": "./server.browser.js",
|
|
"node": {
|
|
"webpack": "./server.node.js",
|
|
"default": "./server.node.unbundled.js"
|
|
},
|
|
"browser": "./server.browser.js"
|
|
},
|
|
"default": "./server.js"
|
|
},
|
|
"./server.browser": "./server.browser.js",
|
|
"./server.edge": "./server.edge.js",
|
|
"./server.node": "./server.node.js",
|
|
"./server.node.unbundled": "./server.node.unbundled.js",
|
|
"./node-loader": "./esm/react-server-dom-webpack-node-loader.production.min.js",
|
|
"./node-register": "./node-register.js",
|
|
"./src/*": "./src/*.js",
|
|
"./package.json": "./package.json"
|
|
},
|
|
"main": "index.js",
|
|
"repository": {
|
|
"type" : "git",
|
|
"url" : "https://github.com/facebook/react.git",
|
|
"directory": "packages/react-server-dom-webpack"
|
|
},
|
|
"engines": {
|
|
"node": ">=0.10.0"
|
|
},
|
|
"peerDependencies": {
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"webpack": "^5.59.0"
|
|
},
|
|
"dependencies": {
|
|
"acorn-loose": "^8.3.0",
|
|
"neo-async": "^2.6.1",
|
|
"loose-envify": "^1.1.0"
|
|
},
|
|
"browserify": {
|
|
"transform": [
|
|
"loose-envify"
|
|
]
|
|
}
|
|
}
|