kibana/packages/kbn-build/webpack.config.js

49 lines
1 KiB
JavaScript
Raw Normal View History

const path = require('path');
module.exports = {
entry: {
index: './src/index.js'
},
target: 'node',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
libraryTarget: 'commonjs2',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader'
}
},
// Removing an unnecessary require from
// https://github.com/ForbesLindesay/spawn-sync/blob/8ba6d1bd032917ff5f0cf68508b91bb628d16336/index.js#L3
//
// This require would cause warnings when building with Webpack, and it's
// only required for Node <= 0.12.
{
test: /spawn-sync\/index\.js$/,
use: {
loader: 'string-replace-loader',
options: {
search: ` || require('./lib/spawn-sync')`,
replace: '',
strict: true
}
}
}
]
},
node: {
// Don't replace built-in globals
__filename: false,
__dirname: false
}
};