[v3] migrate graphiql to vite and react compiler#3826
Conversation
| crossorigin | ||
| src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" | ||
| ></script> | ||
| <script src="/dist/index.umd.js"></script> |
There was a problem hiding this comment.
this should be graphiql.js or else it will break all the unpkg implementations
There was a problem hiding this comment.
what do you mean by it will break all the unpkg implementations?
/dist/index.umd.js === /graphql.js
/dist/index.umd.js === /graphql.min.js
| app.use(express.static(path.join(__dirname, '..'))); | ||
| } else { | ||
| app.get('/', (req, res) => { | ||
| res.redirect('http://localhost:5173'); |
There was a problem hiding this comment.
this is fine as long as it's serving the unminified umd version
There was a problem hiding this comment.
I made to use umd build only on CI, and you can see that all tests pass
locally I replace umd import
graphiql/packages/graphiql/index.html
Lines 26 to 37 in ad75cda
with src/cdn.ts
graphiql/packages/graphiql/vite.config.mts
Lines 102 to 111 in ad75cda
|
this looks good so far, but we still need |
| "exports": { | ||
| "./package.json": "./package.json", | ||
| "./style.css": "./dist/style.css", | ||
| "./graphiql.css": "./dist/style.css", |
There was a problem hiding this comment.
exports don't work with jsdelivr/unpkg unfortunately, we must publish to npm with these exact files
There was a problem hiding this comment.
this is for backward compatibility since I added exports field
I added prepublishOnly with the exact files
graphiql/packages/graphiql/package.json
Line 48 in ad75cda
see #3826 (comment) |
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
prepublishOnlywith creating "graphiql.js", "graphiql.min.js", "graphiql.min.js.map", "graphiql.css", "graphiql.min.css"