Created
February 15, 2022 11:39
-
-
Save crutchcorn/b84e6ea3425b719e13d7df0aba8e0273 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 path = require("path"); | |
const CopyPlugin = require("copy-webpack-plugin"); | |
const BundleAnalyzerPlugin = | |
require("webpack-bundle-analyzer").BundleAnalyzerPlugin; | |
const root = path.resolve(__dirname, "./"); | |
module.exports = { | |
name: "seaside-react", | |
entry: "./src/index.tsx", | |
externals: { | |
react: { | |
root: "React", | |
commonjs2: "react", | |
commonjs: "react", | |
amd: "react", | |
umd: "react", | |
}, | |
"prop-types": { | |
root: "PropTypes", | |
commonjs: "prop-types", | |
commonjs2: "prop-types", | |
}, | |
"react-dom": { | |
root: "ReactDOM", | |
commonjs2: "react-dom", | |
commonjs: "react-dom", | |
amd: "react-dom", | |
umd: "react-dom", | |
}, | |
"react-dom/server": { | |
root: "ReactDOMServer", | |
commonjs: "react-dom/server", | |
commonjs2: "react-dom/server", | |
}, | |
}, | |
module: { | |
noParse: [ | |
require.resolve("react"), | |
require.resolve("prop-types"), | |
require.resolve("react-dom"), | |
require.resolve("react-dom/server"), | |
], | |
rules: [ | |
{ | |
test: /\.(ts|tsx|js|jsx)?$/, | |
include: [ | |
path.resolve(root, "index.web.js"), | |
path.resolve(root, "src"), | |
path.resolve(root, "../../node_modules/react-native-uncompiled"), | |
path.resolve(root, "../../node_modules/react-native-dynamic"), | |
path.resolve(root, "../../node_modules/react-native-vector-icons"), | |
path.resolve(root, "../tokens"), | |
], | |
use: [ | |
{ | |
loader: "babel-loader", | |
options: { | |
babelrc: false, | |
configFile: false, | |
cacheDirectory: true, | |
presets: ["@babel/preset-react", "@babel/preset-typescript"], | |
plugins: [["react-native-web"]], | |
}, | |
}, | |
], | |
}, | |
], | |
}, | |
resolve: { | |
extensions: [".tsx", ".ts", ".js"], | |
// alias: { | |
// "react-native$": "react-native-web", | |
// }, | |
}, | |
output: { | |
filename: "react.js", | |
path: path.resolve(__dirname, "dist"), | |
libraryTarget: "commonjs", | |
}, | |
plugins: [new BundleAnalyzerPlugin()], | |
}; | |
module.exports.parallelism = 3; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment