Skip to content

Instantly share code, notes, and snippets.

@cinkagan
Created September 7, 2022 21:59
Show Gist options
  • Save cinkagan/be3b0297c9dbb7a9b4563e3fb0455031 to your computer and use it in GitHub Desktop.
Save cinkagan/be3b0297c9dbb7a9b4563e3fb0455031 to your computer and use it in GitHub Desktop.
Monorepo React Native + ReactJs Storybook
const path = require("path");
module.exports = {
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, "build"),
publicPath: "/",
filename: "bundle.js",
},
devServer: {
contentBase: "./build",
},
resolve: {
modules: ["node_modules", path.resolve("./node_modules")],
extensions: [
".web.mjs",
".mjs",
".web.js",
".js",
".web.ts",
".ts",
".web.tsx",
".tsx",
".json",
".web.jsx",
".jsx",
],
alias: {
react: path.resolve("./node_modules/react"),
"react-native": "react-native-web",
"@storybook/react-native": "@storybook/react",
},
},
module: {
rules: [
{
test: /\.(js|ts|jsx|tsx)?$/,
loader: require.resolve("babel-loader"),
include: [
path.resolve(__dirname, "src"),
path.resolve(__dirname, "../shared-components/src"),
],
options: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
["@babel/preset-typescript", { allowNamespaces: true }],
],
plugins: [require.resolve("babel-plugin-react-native-web")],
},
},
{
test: /\.(s[ac]|c)ss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.(gif|svg|jpg|png)$/,
loader: "file-loader",
},
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment