You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
const semver = require('semver'); |
|
|
|
const webpack = require('webpack'); |
|
const path = require('path'); |
|
const fs = require('fs'); |
|
|
|
var base = require('./webpack.base.conf'); |
|
|
|
const TARGET_NODE_VERSION = process.versions.node; |
|
|
|
base.mode = 'production'; |
|
base.output.filename = "server.js"; |
|
base.optimization.minimize = true; |
|
|
|
const prodRules = [ |
|
{ |
|
test: /\.js$/, |
|
use: { |
|
loader: 'babel-loader', |
|
options: { |
|
plugins: ["transform-object-rest-spread"], // for transpiling "ws" lib |
|
// it's necessare only for node < 8.3.0, |
|
// so could be optimized |
|
presets: [ |
|
["env", { "targets": { "node": TARGET_NODE_VERSION }}] |
|
] |
|
} |
|
} |
|
}, |
|
{ |
|
test: /\.node$/, |
|
use: [ |
|
{ loader: './build/node-loader' }, |
|
{ loader: 'file-loader', options: { name: '[name].[ext]' } } |
|
] |
|
} |
|
]; |
|
|
|
base.module.rules = [...base.module.rules, ...prodRules]; |
|
|
|
module.exports = base;
|
|
|