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.
42 lines
886 B
42 lines
886 B
7 years ago
|
const path = require('path')
|
||
|
const fs = require('fs')
|
||
|
const nodeExternals = require('webpack-node-externals') // eslint-disable-line import/no-extraneous-dependencies
|
||
|
|
||
|
const define = require('./define')
|
||
|
|
||
|
const dirs = p =>
|
||
|
fs
|
||
|
.readdirSync(p)
|
||
|
.filter(f => fs.statSync(path.join(p, f)).isDirectory())
|
||
|
.map(d => path.resolve(__dirname, `${p}/${d}`))
|
||
|
.reduce((result, value) => {
|
||
|
const [key] = value.split('/').slice(-1)
|
||
|
result[key] = value
|
||
|
return result
|
||
|
}, {})
|
||
|
|
||
|
module.exports = {
|
||
|
target: 'node',
|
||
|
|
||
|
entry: dirs(path.resolve(__dirname, '../src/internals')),
|
||
|
|
||
|
externals: [nodeExternals()],
|
||
|
|
||
|
output: {
|
||
|
path: path.resolve(__dirname, '../static'),
|
||
|
filename: '[name].js',
|
||
|
},
|
||
|
|
||
|
module: {
|
||
|
rules: [
|
||
|
{
|
||
|
test: /\.js$/,
|
||
|
use: 'babel-loader',
|
||
|
exclude: /node_modules/,
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
|
||
|
plugins: [define],
|
||
|
}
|