mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
Fixes https://github.com/elastic/kibana/issues/149344 This PR migrates all plugins to packages automatically. It does this using `node scripts/lint_packages` to automatically migrate `kibana.json` files to `kibana.jsonc` files. By doing this automatically we can simplify many build and testing procedures to only support packages, and not both "packages" and "synthetic packages" (basically pointers to plugins). The majority of changes are in operations related code, so we'll be having operations review this before marking it ready for review. The vast majority of the code owners are simply pinged because we deleted all `kibana.json` files and replaced them with `kibana.jsonc` files, so we plan on leaving the PR ready-for-review for about 24 hours before merging (after feature freeze), assuming we don't have any blockers (especially from @elastic/kibana-core since there are a few core specific changes, though the majority were handled in #149370). --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
124 lines
3.3 KiB
JavaScript
124 lines
3.3 KiB
JavaScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 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.
|
|
*/
|
|
|
|
// setup ts/pkg support in this webpack process
|
|
require('@kbn/babel-register').install();
|
|
|
|
const Path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const UiSharedDepsNpm = require('@kbn/ui-shared-deps-npm');
|
|
|
|
const { distDir: UiSharedDepsSrcDistDir } = require('./src/definitions');
|
|
|
|
const MOMENT_SRC = require.resolve('moment/min/moment-with-locales.js');
|
|
|
|
const REPO_ROOT = Path.resolve(__dirname, '..', '..');
|
|
|
|
module.exports = {
|
|
node: {
|
|
child_process: 'empty',
|
|
fs: 'empty',
|
|
},
|
|
externals: {
|
|
module: 'module',
|
|
},
|
|
mode: process.env.NODE_ENV || 'development',
|
|
entry: {
|
|
'kbn-ui-shared-deps-src': './src/entry.js',
|
|
},
|
|
context: __dirname,
|
|
devtool: 'cheap-source-map',
|
|
output: {
|
|
path: UiSharedDepsSrcDistDir,
|
|
filename: '[name].js',
|
|
chunkFilename: 'kbn-ui-shared-deps-src.chunk.[id].js',
|
|
sourceMapFilename: '[file].map',
|
|
devtoolModuleFilenameTemplate: (info) =>
|
|
`kbn-ui-shared-deps-src/${Path.relative(REPO_ROOT, info.absoluteResourcePath)}`,
|
|
library: '__kbnSharedDeps__',
|
|
futureEmitAssets: true,
|
|
},
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
include: [require.resolve('./src/entry.js')],
|
|
use: [
|
|
{
|
|
loader: UiSharedDepsNpm.publicPathLoader,
|
|
options: {
|
|
key: 'kbn-ui-shared-deps-src',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.peggy$/,
|
|
use: [require.resolve('@kbn/peggy-loader')],
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
},
|
|
{
|
|
test: /\.(ttf)(\?|$)/,
|
|
loader: 'url-loader',
|
|
options: {
|
|
limit: 8192,
|
|
},
|
|
},
|
|
{
|
|
test: /\.(js|tsx?)$/,
|
|
exclude: /[\/\\]node_modules[\/\\](?!@kbn)([^\/\\]+)[\/\\]/,
|
|
loader: 'babel-loader',
|
|
options: {
|
|
babelrc: false,
|
|
envName: process.env.NODE_ENV || 'development',
|
|
presets: [require.resolve('@kbn/babel-preset/webpack_preset')],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
|
|
resolve: {
|
|
extensions: ['.js', '.ts', '.tsx'],
|
|
alias: {
|
|
'@elastic/eui$': '@elastic/eui/optimize/es',
|
|
moment: MOMENT_SRC,
|
|
// NOTE: Used to include react profiling on bundles
|
|
// https://gist.github.com/bvaughn/25e6233aeb1b4f0cdb8d8366e54a3977#webpack-4
|
|
'react-dom$': 'react-dom/profiling',
|
|
'scheduler/tracing': 'scheduler/tracing-profiling',
|
|
},
|
|
},
|
|
|
|
optimization: {
|
|
minimize: false,
|
|
noEmitOnErrors: true,
|
|
},
|
|
|
|
performance: {
|
|
// NOTE: we are disabling this as those hints
|
|
// are more tailored for the final bundles result
|
|
// and not for the webpack compilations performance itself
|
|
hints: false,
|
|
},
|
|
|
|
plugins: [
|
|
new MiniCssExtractPlugin({
|
|
filename: '[name].css',
|
|
}),
|
|
|
|
new webpack.DllReferencePlugin({
|
|
context: REPO_ROOT,
|
|
manifest: require(UiSharedDepsNpm.dllManifestPath), // eslint-disable-line import/no-dynamic-require
|
|
}),
|
|
],
|
|
};
|