const { join } = require('path')
const { api } = require('../skypager-webpack')

module.exports = api()
  .target('node')
  .externals(require.resolve('./package.json'))
  .context(__dirname)
  .modules(
    join(__dirname, 'src')
  )
  .modules(`${__dirname}/../`)
  .loader('babel', '.js', {
    include: [
      join(__dirname, 'src'),
    ],
    exclude: [
      /node_modules/,
    ],
  })
  .plugin('webpack.NamedModulesPlugin')

   // Source Map Support in node requires the source-map-support module
  .sourcemap("source-map")
  .plugin("webpack.BannerPlugin", {
    banner: `
    try { require("source-map-support").install(); } catch(e) { }
    global.chai = require('chai');
    global.should = chai.should();
    global.expect = chai.expect();
    `,
    raw: true,
  })
  .getConfig()
