Skip to content

Commit

Permalink
Build: optimize frontend build configs to improve superset-ui-plugin …
Browse files Browse the repository at this point in the history
…dev experience (#9326)

* Upgrade webpack, babel and React

* Upgrade all Babel related packages

Also remove babel-plugin-css-modules-transform that is not in use.

* Remvoe tslib as dependency

* Remove unnecesary packages
  • Loading branch information
ktmud authored Mar 19, 2020
1 parent ff703cf commit c4b53a7
Show file tree
Hide file tree
Showing 16 changed files with 20,711 additions and 12,309 deletions.
18 changes: 12 additions & 6 deletions superset-frontend/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,36 @@
* specific language governing permissions and limitations
* under the License.
*/
const packageConfig = require('./package.json');

module.exports = {
sourceMaps: true,
sourceType: 'unambiguous',
sourceType: 'module',
retainLines: true,
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
loose: true,
shippedProposals: true,
modules: false,
targets: false,
shippedProposals: true,
targets: packageConfig.browserslist,
},
],
[
'@babel/preset-react',
{ development: process.env.BABEL_ENV === 'development' },
],
],
plugins: [
'lodash',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
'react-hot-loader/babel',
'@babel/plugin-proposal-optional-chaining',
['@babel/plugin-transform-runtime', { corejs: 3 }],
'react-hot-loader/babel',
],
env: {
// Setup a different config for tests as they run in node instead of a browser
Expand All @@ -52,8 +58,8 @@ module.exports = {
corejs: 3,
loose: true,
shippedProposals: true,
targets: { node: 'current' },
modules: 'commonjs',
targets: { node: 'current' },
},
],
],
Expand Down
4 changes: 4 additions & 0 deletions superset-frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ module.exports = {
diagnostics: {
warnOnly: true,
},
tsConfig: {
jsx: 'react',
esModuleInterop: true,
},
},
},
};
Loading

0 comments on commit c4b53a7

Please sign in to comment.