feat: ⚡ added setup for exapmle
This commit is contained in:
parent
617bcb36a2
commit
70bab9e69c
@ -1,3 +1,17 @@
|
||||
const path = require('path');
|
||||
const pak = require('../package.json');
|
||||
|
||||
module.exports = {
|
||||
presets: ['module:metro-react-native-babel-preset'],
|
||||
plugins: [
|
||||
[
|
||||
'module-resolver',
|
||||
{
|
||||
extensions: ['.tsx', '.ts', '.js', '.json'],
|
||||
alias: {
|
||||
[pak.name]: path.join(__dirname, '../..', pak.source),
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
@ -1,11 +1,34 @@
|
||||
/**
|
||||
* Metro configuration for React Native
|
||||
* https://github.com/facebook/react-native
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
const path = require('path');
|
||||
const escape = require('escape-string-regexp');
|
||||
const exclusionList = require('metro-config/src/defaults/exclusionList');
|
||||
const pak = require('../package.json');
|
||||
|
||||
const root = path.resolve(__dirname, '../..');
|
||||
|
||||
const modules = Object.keys({
|
||||
...pak.peerDependencies,
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
projectRoot: __dirname,
|
||||
watchFolders: [root],
|
||||
|
||||
// We need to make sure that only one version is loaded for peerDependencies
|
||||
// So we block them at the root, and alias them to the versions in example's node_modules
|
||||
resolver: {
|
||||
blacklistRE: exclusionList(
|
||||
modules.map(
|
||||
(m) =>
|
||||
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
|
||||
)
|
||||
),
|
||||
|
||||
extraNodeModules: modules.reduce((acc, name) => {
|
||||
acc[name] = path.join(__dirname, 'node_modules', name);
|
||||
return acc;
|
||||
}, {}),
|
||||
},
|
||||
|
||||
transformer: {
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
|
@ -25,6 +25,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
||||
"@typescript-eslint/parser": "^5.37.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"babel-plugin-module-resolver": "^5.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^26.6.3",
|
||||
"metro-react-native-babel-preset": "0.72.3",
|
||||
|
10
examples/LaftelVideo/react-native.config.js
Normal file
10
examples/LaftelVideo/react-native.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
const path = require('path');
|
||||
const pak = require('../package.json');
|
||||
|
||||
module.exports = {
|
||||
dependencies: {
|
||||
[pak.name]: {
|
||||
root: path.join(__dirname, '../..'),
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user