Mattias Rådemar
09/22/2021, 2:08 PMError: PrismaClient is unable to be run in the browser.
. I was reading about that I might need to copy over some binaries using copy-webpack-plugin
but I'm not really sure on exactly what needs to be copied. Any pointers?Mattias Rådemar
09/22/2021, 2:46 PMtarget: "node"
fixed the issue of getting a browser env.
Now seeing this instead.Mattias Rådemar
09/22/2021, 3:42 PMconst path = require("path");
const nodeExternals = require("webpack-node-externals");
const Dotenv = require("dotenv-webpack");
module.exports = {
target: "node",
mode: "development",
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
entry: {
index: "./index.ts",
},
output: {
path: path.resolve(__dirname),
filename: "../../packages/RP/index.js",
},
devtool: "eval-source-map",
externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
externals: [
nodeExternals({
modulesDir: "../../node_modules",
}),
], // in order to ignore all modules in node_modules folder
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: "ts-loader",
options: { transpileOnly: true },
},
],
exclude: "/node_modules/",
},
],
},
plugins: [
new Dotenv(),
],
};