import * as path from 'path' ; import * as webpack from 'webpack' ; import { webpackConfig , webpackMerge , htmlOverlay } from 'just-scripts' ; const IgnoreNotFoundExportWebpackPlugin = require ( 'ignore-not-found-export-webpack-plugin' ) ; export interface DigestConfig { configDir : string ; outputDir : string ; } export const defaultConfig = ( digestConfig ) : webpack . Configuration [ ] => { const bundle = webpackMerge ( webpackConfig , htmlOverlay ( { template : require . resolve ( '../assets/index.html' ) } ) , { entry : { digest : require . resolve ( '../lib/bundle/index.digest.js' ) } , mode : 'production' , output : { filename : '[name].js' } , resolve : { alias : { stories : path . resolve ( __dirname , '.' ) } } , optimization : { minimize : false } , plugins : [ new IgnoreNotFoundExportWebpackPlugin ( { include : [ /\.tsx?$/ ] } ) , ] } ) ; const stories = webpackMerge ( webpackConfig , { target : 'node' , entry : { stories : require . resolve ( '../lib/bundle/stories.js' ) } , mode : 'production' , output : { filename : '[name].js' , library : 'example' , libraryTarget : 'umd' , umdNamedDefine : true } , resolve : { alias : { stories : path . resolve ( __dirname , '.' ) } } , optimization : { minimize : false } , plugins : [ new IgnoreNotFoundExportWebpackPlugin ( { include : [ /\.tsx?$/ ] } ) , ] } ) ; return [ bundle , stories ] ; } ;