forked from react-native-cask-ui/react-native-cask-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
39 lines (33 loc) · 1.1 KB
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const fs = require('fs');
// eslint-disable-next-line import/no-extraneous-dependencies
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
module.exports = config => {
const packages = path.resolve(__dirname, 'packages');
config.context = path.resolve(__dirname);
config.module.rules.push(
{
test: /\.(js|ts|tsx)$/,
include: /(packages|example|wallet)\/.+/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.wasm$/,
type: 'javascript/auto',
},
);
config.resolve.plugins = config.resolve.plugins.filter(p => !(p instanceof ModuleScopePlugin));
fs.readdirSync(packages)
.filter(name => !name.startsWith('.'))
.forEach(name => {
config.resolve.alias[`@qubic-js/react-native-cask-ui-${name}`] = path.resolve(
packages,
name,
// eslint-disable-next-line global-require, import/no-dynamic-require
require(`${__dirname}/packages/${name}/package.json`).source,
);
});
return config;
};