This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'no-restricted-imports': [ | |
| ERROR, | |
| { | |
| name: 'lodash', | |
| message: "Please use our ES6 module lodash import: ==> import { isNil } from '@lodash'", | |
| }, | |
| { | |
| name: 'lodash/chain', | |
| message: 'This function is not exported as an ES6 module, please use an alternative', | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| /* Basic Options */ | |
| "target": "esnext", | |
| "module": "commonjs", | |
| "lib": ["es2017"], .... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "compilerOptions": { | |
| /* Basic Options */ | |
| "target": "esnext", | |
| "module": "es2015" or "esnext", | |
| "lib": ["es2017"], .... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "paths": { | |
| "@lodash": ["src/common/utils/lodash/lodashES.ts"], | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export { default as cloneDeep } from 'lodash/cloneDeep'; | |
| export { default as find } from 'lodash/find'; | |
| export { default as findIndex } from 'lodash/findIndex'; | |
| export { default as flow } from 'lodash/flow'; | |
| export { default as forEach } from 'lodash/forEach'; | |
| etc... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| component file: | |
| replace all lodash import statement by @lodash e.g. | |
| import { orderBy } from 'lodash'; | |
| becomes: | |
| import { orderBy } from '@lodash'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "presets": ["module:metro-react-native-babel-preset", "@babel/preset-typescript", "@babel/preset-react"], | |
| "parserOpts": { "strictMode": true }, | |
| "plugins": [ | |
| [ | |
| "module-resolver", | |
| { | |
| "root": ["./"], | |
| "extensions": [".ios.js", ".android.js", ".js", ".ts", ".tsx", ".json"], | |
| "alias": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npx react-native-bundle-visualizer - only-mapped - bundle-output ./myapp.bundle - format html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tsconfig.json 'module': XXX | node_modules size | lodash size | lodash tree shaking activated | |
|---|---|---|---|---|
| 'commonsjs' (without our mapping) | 2.95MB | 117KB | NO | |
| 'commonsjs' (with our mapping) | 2.88MB | 46KB | YES | |
| 'esnext' (without our mapping) | 2.97MB | 117KB | NO | |
| 'esnext' (with babel plugin) | 2.9MB | 46KB | YES |