Closed radiorz closed 2 years ago
I can use webpack4 to pack the node project to one file like this :
'use strict'; const path = require('path'); let externals = _externals(); module.exports = { mode: 'production', entry: { app: './index.js' }, target: 'node', output: { path: path.resolve('./build'), filename: '[name].cjs' }, resolve: { extensions: ['.js'] }, externals: externals, node: { console: true, global: true, process: true, Buffer: true, __filename: true, __dirname: true, setImmediate: true }, module: {}, plugins: [] }; function _externals() { let manifest = require('./package.json'); let dependencies = manifest.dependencies; let externals = {}; for (let p in dependencies) { externals[p] = 'commonjs ' + p; } return externals; }
How to build by vite or vite-node?
This is out-of-scope of this project.
I can use webpack4 to pack the node project to one file like this :
How to build by vite or vite-node?