-
-
Save jookovjook/d0a418643b27d9ffca986c825d94597f to your computer and use it in GitHub Desktop.
This file contains 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
const fs = require('fs') | |
const path = require('path') | |
const webpack = require('webpack') | |
const appDirectory = fs.realpathSync(process.cwd()) | |
const resolveApp = relativePath => path.resolve(appDirectory, relativePath) | |
// our packages that will now be included in the CRA build step | |
const appIncludes = [ | |
resolveApp('src'), | |
resolveApp('../src'), | |
resolveApp('../node_modules/react-native-vector-icons') | |
] | |
module.exports = function override(config, env) { | |
// allow importing from outside of src folder | |
config.resolve.plugins = config.resolve.plugins.filter( | |
plugin => plugin.constructor.name !== 'ModuleScopePlugin' | |
) | |
config.module.rules[0].include = appIncludes | |
config.module.rules[1] = null | |
config.module.rules[2].oneOf[1].include = appIncludes | |
config.module.rules[2].oneOf[1].options.plugins = [ | |
require.resolve('babel-plugin-react-native-web'), | |
require.resolve('@babel/plugin-proposal-class-properties'), | |
].concat(config.module.rules[2].oneOf[1].options.plugins) | |
config.module.rules.push({ | |
test: /\.ttf$/, | |
loader: "url-loader", // or directly file-loader | |
include: resolveApp("../../node_modules/react-native-vector-icons"), | |
}); | |
config.module.rules = config.module.rules.filter(Boolean) | |
config.plugins.push( | |
new webpack.DefinePlugin({ __DEV__: env !== 'production' }) | |
) | |
return config | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment