Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const defaultConfig = (digestConfig: DigestConfig): webpack.Configuration[] => {
// TODO: optimize configs to share common instances and remove usage of just (use webpack-merge directly)
const bundle = webpackMerge(
webpackConfig,
htmlOverlay({
// TODO: is require.resolve really needed here? path.join / __dirname instead?
template: require.resolve('../assets/index.html'),
}),
{
// TODO: should entry really be pointing to lib output rather than ts?
// TODO: reduce to entry: string?
entry: {
digest: require.resolve('../lib/bundle/index.digest.js'),
},
mode: 'production',
output: {
filename: '[name].js',
},
resolve: {
},
optimization: {
minimize: false,
},
plugins: [
// This plugin was added to ignore warnings wherever types are imported.
new IgnoreNotFoundExportWebpackPlugin({ include: [/\.tsx?$/] }),
],
},
)
// This config creates a bundle that can be imported directly by the perf-test script to see all available stories.
// Currently this is bundling all stories and their dependencies when all the script really needs is the story information.
// The bundle size may be optimized later somehow, whether by backfilling require.context or somehow using a
// webpack plugin to extract story information during bundling.
const stories = webpackMerge(webpackConfig, {
target: 'node',
entry: {
// TODO: If users are passing in require.context args, the entry here should probably
// be something that just requires.context on those args and returns just story
// information.
stories: require.resolve('../lib/bundle/stories.js'),
},
mode: 'production',
output: {
filename: '[name].js',
library: 'example',
libraryTarget: 'umd',
umdNamedDefine: true,
},
resolve: {
alias: {
const { webpackMerge, htmlOverlay, webpackServeConfig } = require('just-scripts');
module.exports = webpackMerge(webpackServeConfig, htmlOverlay);