From 02fa30a45af711ee499688d99a5e8fddab53e3fb Mon Sep 17 00:00:00 2001 From: frankpagan Date: Mon, 30 Oct 2023 02:52:14 -0600 Subject: [PATCH] testing server side build --- package.json | 6 +++++ webpack.config.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 webpack.config.js diff --git a/package.json b/package.json index 35e5f50..e2540fc 100644 --- a/package.json +++ b/package.json @@ -58,5 +58,11 @@ "@cocreate/unique": "^1.15.5", "@cocreate/users": "^1.28.2", "@cocreate/uuid": "^1.7.2" + }, + "devDependencies": { + "css-loader": "^6.8.1", + "webpack": "^5.89.0", + "webpack-cli": "^5.1.4", + "webpack-node-externals": "^3.0.0" } } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..4745df9 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,57 @@ +const path = require('path'); +// const webpack = require('webpack'); +const nodeExternals = require('webpack-node-externals'); + +module.exports = { + entry: './src/server.js', // Entry point for your server code + target: 'node-webkit', // node, commonjs// Specifies that the bundle should be targeted for Node.js + // externalsPresets: { node: true }, + output: { + filename: 'server.bundle.js', // Output file name + path: path.resolve(__dirname, 'dist'), // Output directory + libraryTarget: 'commonjs', + }, + optimization: { + minimize: false, // Prevents minification of the output + }, + mode: 'production', // Set the mode to 'production' to optimize the bundle + // externals: [nodeExternals({ + // // importType: 'commonjs', // commonjs, amd + // // modulesFromFile: true, + // // allowlist: ['ws', '@cocreate/organizations'], + // allowlist: [ + // "@cocreate/authenticate", + // "@cocreate/authorize", + // "@cocreate/config", + // "@cocreate/crud-server", + // "@cocreate/file-server", + // "@cocreate/industry", + // "@cocreate/metrics-server", + // "@cocreate/mongodb", + // // "@cocreate/notification", + // // "@cocreate/organizations", + // "@cocreate/server-side-render", + // "@cocreate/socket-server", + // // "@cocreate/unique", + // // "@cocreate/users", + // // "@cocreate/uuid", + // // "fs", + // // "http", + // // "path", + // // "events", + // 'ws' + // ], + + // })] + + // externals: [nodeExternals({ + // importType: 'commonjs', + // modulesFromFile: true, // Use modules from package.json + // modulesDir: 'node_modules', // Set the node_modules directory + // modulesFromFile: { + // fileName: path.resolve(__dirname, 'package.json'), + // includeInBundle: ['dependencies'], // Include dependencies and peerDependencies + // }, + // allowlist: [], + // })] +};