e5d8d49164
* chore(NA): script to check for multiple version of same dependency * chore(NA): remove multiple versions for the same dependency * chore(NA): hook single_version_dependencies script into the CI * chore(NA): remove grunt from the CI hook integration * chore(NA): update kbn pm dist * chore(NA): fix typechecking * chore(NA): update code to run under last extract-zip version * fix(NA): multiple versions of the same type dependency * move validation to bootstrap (#13) Co-authored-by: spalger <spalger@users.noreply.github.com> * chore(NA): todo to remove logic to validate single version deps once we move into a single package.json * chore(NA): remove verify dependency versions jenkins task * chore(NA): update kbn pm dist file * chore(NA): remove last mention to verify_dependency_versions.sh fom tasks.groovy Co-authored-by: Spencer <email@spalger.com> Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
105 lines
3.3 KiB
TypeScript
105 lines
3.3 KiB
TypeScript
/*
|
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
import { resolve } from 'path';
|
|
import { stringifyRequest } from 'loader-utils';
|
|
import { Configuration, Stats } from 'webpack';
|
|
import webpackMerge from 'webpack-merge';
|
|
import { externals } from '@kbn/ui-shared-deps';
|
|
import { REPO_ROOT } from './lib/constants';
|
|
|
|
const stats = {
|
|
...Stats.presetToOptions('minimal'),
|
|
colors: true,
|
|
errorDetails: true,
|
|
errors: true,
|
|
moduleTrace: true,
|
|
warningsFilter: /(export .* was not found in)|(entrypoint size limit)/,
|
|
};
|
|
|
|
// Extend the Storybook Webpack config with some customizations
|
|
/* eslint-disable import/no-default-export */
|
|
export default function ({ config: storybookConfig }: { config: Configuration }) {
|
|
const config = {
|
|
devServer: {
|
|
stats,
|
|
},
|
|
externals,
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(html|md|txt|tmpl)$/,
|
|
use: {
|
|
loader: 'raw-loader',
|
|
},
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
exclude: /\.module.(s(a|c)ss)$/,
|
|
use: [
|
|
{ loader: 'style-loader' },
|
|
{ loader: 'css-loader', options: { importLoaders: 2 } },
|
|
{
|
|
loader: 'postcss-loader',
|
|
options: {
|
|
config: {
|
|
path: require.resolve('@kbn/optimizer/postcss.config.js'),
|
|
},
|
|
},
|
|
},
|
|
{
|
|
loader: 'sass-loader',
|
|
options: {
|
|
prependData(loaderContext: any) {
|
|
return `@import ${stringifyRequest(
|
|
loaderContext,
|
|
resolve(REPO_ROOT, 'src/core/public/core_app/styles/_globals_v7light.scss')
|
|
)};\n`;
|
|
},
|
|
sassOptions: {
|
|
includePaths: [resolve(REPO_ROOT, 'node_modules')],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
// Tell Webpack about the scss extension
|
|
extensions: ['.scss'],
|
|
alias: {
|
|
core_app_image_assets: resolve(REPO_ROOT, 'src/core/public/core_app/images'),
|
|
},
|
|
},
|
|
stats,
|
|
};
|
|
|
|
// This is the hacky part. We find something that looks like the
|
|
// HtmlWebpackPlugin and mutate its `options.template` to point at our
|
|
// revised template.
|
|
const htmlWebpackPlugin: any = (storybookConfig.plugins || []).find((plugin: any) => {
|
|
return plugin.options && typeof plugin.options.template === 'string';
|
|
});
|
|
if (htmlWebpackPlugin) {
|
|
htmlWebpackPlugin.options.template = require.resolve('../lib/templates/index.ejs');
|
|
}
|
|
return webpackMerge(storybookConfig, config);
|
|
}
|