-
-
Notifications
You must be signed in to change notification settings - Fork 389
Reuse babel options and specify polyfills for karma explicitely #1456
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
Changes from 2 commits
73facad
48e8aad
9e467e7
a932be7
17d4f74
1f60896
505b43d
0763e98
c571489
8639266
7c1ce10
ec948c7
4daeb30
0533333
881e099
55c8f16
c0a4db4
a16a2a8
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| exports.getBabelOptions = ({useESModules}) => ({ | ||
| presets: [['@babel/env', {loose: true}], '@babel/flow', '@babel/react'], | ||
| plugins: [ | ||
| ['@babel/proposal-class-properties', {loose: true}], | ||
| ['@babel/transform-runtime', {useESModules}], | ||
| ['@babel/plugin-proposal-export-namespace-from'], | ||
|
Member
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. Is this plugin actually used?
Member
Author
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 searched for
Member
Author
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 guess we can remove it |
||
| ['dev-expression'] | ||
| ] | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ## JavaScript Environment Requirements | ||
|
|
||
| We run our tests against a [number of browsers](../browsers.json) but we do NOT include polyfills for older browsers. It is up to the user to include polyfills depending on what environment they want to support. | ||
|
|
||
| It is hard to compile and maintain a full list of required polyfills for each runtime for each version of JSS, so we think you should test your application in the browser you support, and you will see if any polyfill is missing. | ||
|
|
||
| We recommend using [babel-preset-env](https://babeljs.io/docs/en/babel-preset-env), which is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, browser polyfills) are needed by your target environment(s). This both makes your life easier and JavaScript bundles smaller! |
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.
Do you remember why we didn't use babel.config.js?
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.
no, but I would guess the useESModules option is dynamic, that's why?
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.
Yes, but it can be used only for rollup. There is no difference between inlined and imported helpers.
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.
using the option for rollup only is fine, it's still better than having the entire babel config duplicted
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.
Btw, babel 7.13 does not require useESModules flag anymore. Right version is detected automatically.
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.
then we can remove the flag along with upgrading babel, probably better separately