forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
65 lines (62 loc) · 2.07 KB
/
webpack.config.ts
File metadata and controls
65 lines (62 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
/* eslint-disable import/no-default-export */
import { externals } from '@kbn/ui-shared-deps-src';
import { resolve } from 'path';
import type { Configuration } from 'webpack';
import { merge as webpackMerge } from 'webpack-merge';
import { NodeLibsBrowserPlugin } from '@kbn/node-libs-browser-webpack-plugin';
import { REPO_ROOT } from './lib/constants';
import { IgnoreNotFoundExportPlugin } from './ignore_not_found_export_plugin';
import 'webpack-dev-server'; // Extends webpack configuration with `devServer` property
export default ({ config: storybookConfig }: { config: Configuration }) => {
const config: Configuration = {
devServer: {
devMiddleware: {
stats: 'errors-only',
},
},
externals,
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
{
test: /\.(html|md|txt|tmpl)$/,
type: 'asset/source',
},
{
test: /\.peggy$/,
use: {
loader: require.resolve('@kbn/peggy-loader'),
},
},
{
test: /\.text$/,
use: {
loader: require.resolve('@kbn/dot-text-loader'),
},
},
],
},
plugins: [new NodeLibsBrowserPlugin(), new IgnoreNotFoundExportPlugin()],
resolve: {
extensions: ['.js', '.mjs', '.ts', '.tsx', '.json', '.mdx'],
mainFields: ['browser', 'main'],
alias: {
core_styles: resolve(REPO_ROOT, 'src/core/public/index.scss'),
},
},
stats: 'errors-only',
};
return webpackMerge(storybookConfig, config);
};