Skip to content

Commit

Permalink
webui generates es2017 output and removes confusing babel config
Browse files Browse the repository at this point in the history
Babel dependencies were configured but not actually used by any webui bundles since they are all typescript.
Typescript was not configured to output using the latest features supported by v8.

This re-configuration ensures:
- TS output is transpiled to es2017 JS and no further, which should allow for optimizations. Previously it was es5.
- es module syntax is preserved, allowing webpack to tree shake
- async lazy-load import() syntax is preserved, allowing webpack to perform chunking

This also fixes an issue whereby linking brave-ui dependency from a local path would prevent webui compilation.
  • Loading branch information
petemill committed Dec 5, 2018
1 parent 78b0533 commit 10b86f3
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 975 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

12 changes: 8 additions & 4 deletions components/brave_rewards/resources/ui/components/pageWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as utils from '../utils'
import WalletOff from 'brave-ui/features/rewards/walletOff'
import ModalAddFunds from 'brave-ui/features/rewards/modalAddFunds'

import clipboardCopy = require('clipboard-copy')
const clipboardCopy = require('clipboard-copy')

interface State {
activeTabId: number
Expand Down Expand Up @@ -74,10 +74,14 @@ class PageWallet extends React.Component<Props, State> {
})
}

onModalBackupOnCopy = (backupKey: string) => {
const success = clipboardCopy(backupKey)
onModalBackupOnCopy = async (backupKey: string) => {
// TODO(jsadler) possibly flash a message that copy was completed
console.log(success ? 'Copy successful' : 'Copy failed')
try {
await clipboardCopy(backupKey)
console.log('Copy successful')
} catch (e) {
console.log('Copy failed')
}
}

onModalBackupOnPrint = (backupKey: string) => {
Expand Down
1 change: 0 additions & 1 deletion components/common/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ export const getLocale = (key: string, replacements?: Record<string, string>) =>
return returnVal
}

module.exports = { getLocale }
8 changes: 0 additions & 8 deletions components/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ module.exports = (env, argv) => ({
test: /\.tsx?$/,
loader: 'awesome-typescript-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['react-optimize']
}
},
{
test: /\.less$/,
loader: 'style-loader!css-loader?-minimize!less-loader'
Expand Down
Loading

0 comments on commit 10b86f3

Please sign in to comment.