react-mapfilter
Version:
These components are designed for viewing data in Mapeo. They share a common interface:
86 lines (85 loc) • 2.74 kB
Plain Text
// This file is formatted as JSON5 https://github.com/json5/json5
{
presets: [
// Transforms JSX
'@babel/preset-react',
// Transforms ES6 code and import/export statements
[
'@babel/preset-env',
{
targets: {
electron: '2.0.0',
node: '8',
browsers: ['last 2 versions', 'not ie < 11']
},
// Only use polyfills necessary for target env
useBuiltIns: 'usage',
corejs: 3,
shippedProposals: true
}
]
],
plugins: [
// Reduces bundle size by sharing babel helpers between files
['@babel/plugin-transform-runtime', { corejs: 3 }],
// Allows simpler defineMessages with react-intl
// https://github.com/akameco/babel-plugin-react-intl-auto
['react-intl-auto', { filebase: true, removePrefix: 'src' }],
// Turns flow type annotations into React.PropTypes for runtime
// type checking. Deadcode wraps in NODE_ENV checks
// ['flow-react-proptypes', { deadCode: true }],
// Converts flow annotations into comment syntax
// https://flow.org/en/docs/types/comments/
'@babel/plugin-transform-flow-comments',
// Allows directly declaring props and methods on a class instead of
// binding them to `this` in the constructor
'@babel/plugin-proposal-class-properties',
// Allows short hand of Object.assign({}, a) as {...a}
// useBuiltIns should be fine for our use-case, but could cause un-expected
// results if trying to spread objects with a prototype chains. See
// https://exploringjs.com/es6/ch_oop-besides-classes.html#sec_assigning-vs-defining-properties
[
'@babel/plugin-proposal-object-rest-spread',
{ loose: true, useBuiltIns: true }
]
],
env: {
esm: {
plugins: [
[
'react-intl-auto',
{ filebase: true, extractComments: false, removePrefix: 'src' }
],
// Creates shorter message hashes to reduce bundle size
'react-intl-id-hash'
],
presets: [
[
'@babel/preset-env',
{
targets: {
// Our main target for these modules is the mapeo-desktop electron
// application.
electron: '2.0.0'
},
modules: false,
// Only use polyfills necessary for target env
useBuiltIns: 'usage',
corejs: 3,
shippedProposals: true
}
]
]
},
cjs: {
plugins: [
[
'react-intl-auto',
{ filebase: true, extractComments: false, removePrefix: 'src' }
],
// Creates shorter message hashes to reduce bundle size
'react-intl-id-hash'
]
}
}
}