Skip to content

Commit

Permalink
Update plugin rollup polyfill package (#3621)
Browse files Browse the repository at this point in the history
* Replace node polyfill rollup plugins

* Re-export 'react/jsx-runtime'

* Comment on usage of include:null in nodePolyfill

* Fix typos
  • Loading branch information
garrettjstevens authored and cmdcolin committed May 18, 2023
1 parent 47002c0 commit 8c388d6
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 728 deletions.
1 change: 1 addition & 0 deletions packages/core/ReExports/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default [
'mobx',
'mobx-state-tree',
'react',
'react/jsx-runtime',
'react-dom',
'mobx-react',
'@mui/x-data-grid',
Expand Down
2 changes: 2 additions & 0 deletions packages/core/ReExports/modules.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// this is all the stuff that the pluginManager re-exports for plugins to use
import React, { lazy, LazyExoticComponent, Suspense } from 'react'
import * as ReactJSXRuntime from 'react/jsx-runtime'
import * as ReactDom from 'react-dom'
import * as mobx from 'mobx'
import * as mst from 'mobx-state-tree'
Expand Down Expand Up @@ -503,6 +504,7 @@ const libs = {
mobx,
'mobx-state-tree': mst,
react: React,
'react/jsx-runtime': ReactJSXRuntime,
'react-dom': ReactDom,
'mobx-react': mxreact,
'@mui/x-data-grid': {
Expand Down
6 changes: 2 additions & 4 deletions plugin-development-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"chalk": "^4.1.1",
"lodash.merge": "^4.6.2",
"rollup-plugin-external-globals": "^0.6.1",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-polyfill-node": "^0.12.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2"
},
Expand All @@ -58,8 +57,7 @@
"typescript": "^4.0.0"
},
"devDependencies": {
"@types/rollup-plugin-node-builtins": "^2.1.2",
"@types/rollup-plugin-node-globals": "^1.4.1",
"rimraf": "^4.1.2",
"rollup": "^2.77.0",
"typescript": "^4.7.4"
},
Expand Down
10 changes: 6 additions & 4 deletions plugin-development-tools/src/createRollupConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import typescript from '@rollup/plugin-typescript'
import path from 'path'
import { defineConfig, OutputOptions, Plugin, RollupOptions } from 'rollup'
import externalGlobals from 'rollup-plugin-external-globals'
import builtins from 'rollup-plugin-node-builtins'
import globals from 'rollup-plugin-node-globals'
import nodePolyfills from 'rollup-plugin-polyfill-node'
import sourceMaps from 'rollup-plugin-sourcemaps'
import { terser } from 'rollup-plugin-terser'
import { babelPluginJBrowse } from './babelPluginJBrowse'
Expand Down Expand Up @@ -86,8 +85,11 @@ function getPlugins(
}),
mode === 'npm' && sourceMaps(),
mode === 'npm' && writeIndex(packageName, distPath),
(mode === 'esmBundle' || mode === 'umd') && globals(),
(mode === 'esmBundle' || mode === 'umd') && builtins(),
(mode === 'esmBundle' || mode === 'umd') &&
// By default, nodePolyfills only polyfills code in node_modules/. We set
// to null here to include the plugin source code itself (and for Yarn 2/3
// compatibility, since it doesn't use node_modules/).
nodePolyfills({ include: null }),
(mode === 'cjs' || mode === 'esmBundle') && omitUnresolved(),
].filter(Boolean)

Expand Down
Loading

0 comments on commit 8c388d6

Please sign in to comment.