UNPKG

libre

Version:
52 lines (46 loc) 1.02 kB
var webpack = require('webpack'); var path = require('path'); var fs = require('fs'); const externals = () => { const nodeModules = {}; fs.readdirSync('node_modules') .filter(function(x) { return ['.bin'].indexOf(x) === -1; }) .forEach(function(mod) { nodeModules[mod] = 'commonjs ' + mod; }); return nodeModules; }; var common = { target: 'node', externals: externals(), module: { rules: [ { test: /\.js$/, use: {loader: 'babel-loader'}, exclude: /node_modules/ } ] } }; var libre = Object.assign({}, common, { entry: './src/index.js', output: { // path: path.join(__dirname, './bin'), path: __dirname, filename: 'index.js', libraryTarget: 'commonjs' }, }); var server = Object.assign({}, common, { entry: './src/server/index.js', output: { path: __dirname, // path: path.join(__dirname, './bin'), filename: 'server.js', libraryTarget: 'commonjs' }, }); module.exports = [libre, server];