2018-05-29 05:06:30 +02:00
|
|
|
/*
|
2021-01-20 02:52:56 +01:00
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
2021-02-04 03:12:39 +01:00
|
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
|
|
* Side Public License, v 1.
|
2018-05-29 05:06:30 +02:00
|
|
|
*/
|
|
|
|
|
2018-01-24 10:34:52 +01:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = {
|
2018-12-11 01:53:58 +01:00
|
|
|
mode: 'none',
|
2018-01-24 10:34:52 +01:00
|
|
|
entry: {
|
2018-02-21 10:09:30 +01:00
|
|
|
index: './src/index.ts',
|
2018-01-24 10:34:52 +01:00
|
|
|
},
|
|
|
|
target: 'node',
|
|
|
|
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'dist'),
|
|
|
|
filename: '[name].js',
|
|
|
|
libraryTarget: 'commonjs2',
|
|
|
|
},
|
|
|
|
|
2018-02-21 10:09:30 +01:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js'],
|
2021-03-15 21:17:54 +01:00
|
|
|
symlinks: false,
|
2018-02-21 10:09:30 +01:00
|
|
|
},
|
|
|
|
|
2018-01-24 10:34:52 +01:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2018-02-21 10:09:30 +01:00
|
|
|
test: /\.ts$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
exclude: /node_modules/,
|
2018-01-24 10:34:52 +01:00
|
|
|
},
|
|
|
|
// 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: '',
|
2018-02-05 18:18:43 +01:00
|
|
|
strict: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-12-10 18:41:51 +01:00
|
|
|
// In order to make it work with Node 10 we had the need to upgrade
|
|
|
|
// the package cpy to a version >= 7.0.0. In this version cpy is
|
|
|
|
// using the new globby that relies in the fast-glob which relies
|
|
|
|
// in the new micromatch. The micromatch (use and class-utils) dependencies having a require
|
|
|
|
// that uses the lazy-cache which cannot be correctly extracted by webpack.
|
|
|
|
// According to the documentation we should use the unlazy-loader to solve
|
|
|
|
// this situation: https://github.com/jonschlinkert/lazy-cache#heads-up
|
|
|
|
// We can also found some issues arround this who also used unlazy-loader
|
|
|
|
// to solve this: https://github.com/micromatch/micromatch/issues/55
|
|
|
|
{
|
|
|
|
test: /node_modules\/(use|class-utils)\/utils\.js$/,
|
|
|
|
use: {
|
|
|
|
loader: 'unlazy-loader',
|
|
|
|
},
|
|
|
|
},
|
2018-02-05 18:18:43 +01:00
|
|
|
],
|
2018-01-24 10:34:52 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
node: {
|
|
|
|
// Don't replace built-in globals
|
|
|
|
__filename: false,
|
2018-02-05 18:18:43 +01:00
|
|
|
__dirname: false,
|
|
|
|
},
|
2018-03-26 17:54:40 +02:00
|
|
|
|
2019-08-23 22:50:07 +02:00
|
|
|
externals: {
|
|
|
|
worker_threads: {
|
|
|
|
commonjs: 'worker_threads',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-03-26 17:54:40 +02:00
|
|
|
watchOptions: {
|
|
|
|
ignored: [/node_modules/, /vendor/],
|
|
|
|
},
|
2018-01-24 10:34:52 +01:00
|
|
|
};
|