forked from nandorojo/dripsy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
46 lines (38 loc) · 1.42 KB
/
webpack.config.js
File metadata and controls
46 lines (38 loc) · 1.42 KB
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
40
41
42
43
44
45
46
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const fs = require('fs')
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin')
const node_modules = path.resolve(__dirname, '../..', 'node_modules')
const packages = path.resolve(__dirname, '../..', 'packages')
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv)
config.context = path.resolve(__dirname, '../..')
config.module.rules.push({
test: /\.(js|ts|tsx)$/,
include: /(packages|example)\/.+/,
exclude: /node_modules/,
use: 'babel-loader',
})
config.resolve.plugins = config.resolve.plugins.filter(
(p) => !(p instanceof ModuleScopePlugin)
)
Object.assign(config.resolve.alias, {
react: path.resolve(node_modules, 'react'),
'react-native': path.resolve(node_modules, 'react-native-web'),
'react-native-web': path.resolve(node_modules, 'react-native-web'),
'@expo/vector-icons': path.resolve(node_modules, '@expo/vector-icons'),
})
fs.readdirSync(packages)
.filter((name) => !name.startsWith('.'))
.forEach((name) => {
config.resolve.alias[
name === 'dripsy' ? 'dripsy' : `@dripsy/${name}`
] = path.resolve(
packages,
name,
require(`../../packages/${name}/package.json`).source
)
})
return config
}