-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Publish bundles instead of modules, use babel only for transpilation #2214
Changes from all commits
38bfb21
5985acc
5850ca7
e0115ac
3eda9ac
e7b653c
ae3b358
3f73b29
eec804d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
{ | ||
"presets": [ | ||
["@babel/env", { | ||
"loose": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Original code: ref.current?.focus({ preventScroll: true }); With (_ref$current = ref.current) == null ? void 0 : _ref$current.focus({ With (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus({ In non-loose mode, the value is explicitely checked for both It might matter in the future for new js syntax features, but |
||
"bugfixes": true, | ||
"shippedProposals": true, | ||
"corejs": 3, | ||
"useBuiltIns": "entry" | ||
}] | ||
"useBuiltIns": "entry", | ||
"include": [ | ||
"@babel/proposal-nullish-coalescing-operator", | ||
"@babel/proposal-optional-chaining" | ||
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fun fact: with our browserslist config, and our code, aside from these two transform plugins, |
||
] | ||
}], | ||
["@babel/react", { "useSpread": true }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll change this to use the new runtime in #2184 |
||
"@babel/typescript" | ||
], | ||
"plugins": [ | ||
["@babel/transform-runtime", { "useESModules": true }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might have to add |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { isAbsolute } from 'path'; | ||
import { babel } from '@rollup/plugin-babel'; | ||
import nodeResolve from '@rollup/plugin-node-resolve'; | ||
import sourcemaps from 'rollup-plugin-sourcemaps'; | ||
|
||
const extensions = ['.ts', '.tsx']; | ||
|
||
export default { | ||
input: './lib/index.js', | ||
input: './src/index.ts', | ||
output: [{ | ||
file: './lib/bundle.mjs', | ||
format: 'es', | ||
|
@@ -15,13 +18,16 @@ export default { | |
sourcemap: true, | ||
interop: false | ||
}], | ||
external: [ | ||
'clsx', | ||
'react', | ||
'react-dom' | ||
], | ||
external: id => !id.startsWith('.') && !isAbsolute(id), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will mark all non-relative imports as external, in other words all npm dependencies. |
||
plugins: [ | ||
sourcemaps(), | ||
nodeResolve() | ||
babel({ | ||
babelHelpers: 'runtime', | ||
extensions, | ||
// remove all comments except terser annotations | ||
// https://github.com/terser/terser#annotations | ||
// https://babeljs.io/docs/en/options#shouldprintcomment | ||
shouldPrintComment: comment => /^[@#]__.+__$/.test(comment) | ||
}), | ||
nodeResolve({ extensions }) | ||
] | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tweaked this so we'll now use
type
imports, this is to help babel elide type imports, otherwise it cannot always know to remove some imports, especially in files likesrc/index.ts
.