@component-controls/webpack-configs
v4.0.3
Published
Webpack preset configurations
Downloads
79
Readme
Table of contents
Overview
Collection of standard webpack rules for @component-controls/instrument.
Installation
$ npm install @component-controls/webpack-configs --save-dev
Usage
in .storybook/main.js
Basic usage
addons: [
...
{
name: '@component-controls/storybook',
options: {
webpack: ['react-docgen-typescript']
}
}
],
Advanced usage
addons: [
...
{
name: '@component-controls/storybook',
options: {
webpack: [
'instrument',
{
name: 'react-docgen-typescript',
config: {
module: {
rules: [
{
loader: '@component-controls/loader/loader',
options: {
//instrumentation options
prettier: {
tabWidth: 4,
},
},
},
],
},
},
},
],
}
}],
API
getWebpackConfig
function
expands the presets into webpack config
defined in @component-controls/webpack-configs/core/webpack-configs/src/index.ts
parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| presets*
| RuleType
[] | custom config |
| options*
| BuildProps
webpack
: Configuration
| WebpackConfigFn
finalWebpack
: Configuration
| WebpackConfigFn
presets
: RuleTypesconfigPath
: string
distFolder
: string
bundleName
: string
staticFolder
: string
cssFileName
: string
logOptions
: Partial
<LogOptions
>mode
: "none"
| "development"
| "production"
loaders
encodeHTML
*: encodeHTMLat
*: function (index
*: ) => T
| undefined
module
: string
ident
: string
loader
: string
options
: string
| type
| |
| returns
| WebpackConfiguration
amd
: false
| type
bail
: boolean
cache
: boolean
| MemoryCacheOptions
| FileCacheOptions
context
: string
dependencies
: string
[]devtool
: string
| false
entry
: string
| function
| EntryObject
| string
[]experiments
asyncWebAssembly
: boolean
backCompat
: boolean
cacheUnaffected
: boolean
css
: boolean
futureDefaults
: boolean
layers
: boolean
outputModule
: boolean
syncWebAssembly
: boolean
topLevelAwait
: boolean
buildHttp
: HttpUriOptions
| ((string
, RegExp
, function
))[]lazyCompilation
: boolean
| LazyCompilationOptions
externals
byLayer
: type
| function
externalsPresets
electron
: boolean
electronMain
: boolean
electronPreload
: boolean
electronRenderer
: boolean
node
: boolean
nwjs
: boolean
web
: boolean
webAsync
: boolean
externalsType
: "var"
| "module"
| "assign"
| "this"
| "window"
| "self"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "commonjs-static"
| "amd"
| "amd-require"
| "umd"
| "umd2"
| "jsonp"
| "system"
| "promise"
| "import"
| "script"
| "node-commonjs"
ignoreWarnings
: ((RegExp
, type
, function
))[]infrastructureLogging
appendOnly
: boolean
colors
: boolean
console
: Consoledebug
: string
| boolean
| RegExp
| FilterItemTypes
[] | function
level
: "none"
| "error"
| "warn"
| "info"
| "log"
| "verbose"
stream
: NodeJS.WritableStreamloader
[string
]: any
mode
: "none"
| "development"
| "production"
module
defaultRules
: ((RuleSetRule
, string
))[]exprContextCritical
: boolean
exprContextRecursive
: boolean
exprContextRegExp
: boolean
| RegExp
exprContextRequest
: string
generator
asset
*: asset/inline
*: asset/resource
*: javascript
*: javascript/auto
*: javascript/dynamic
*: javascript/esm
*: noParse
: string
| Function
| RegExp
| ((string
, Function
, RegExp
))[]parser
asset
*: asset/inline
*: asset/resource
*: asset/source
*: javascript
*: javascript/auto
*: javascript/dynamic
*: javascript/esm
*: rules
: ((RuleSetRule
, string
))[]strictExportPresence
: boolean
strictThisContextOnImports
: boolean
unknownContextCritical
: boolean
unknownContextRecursive
: boolean
unknownContextRegExp
: boolean
| RegExp
unknownContextRequest
: string
unsafeCache
: boolean
| Function
wrappedContextCritical
: boolean
wrappedContextRecursive
: boolean
wrappedContextRegExp
: RegExp
name
: string
node
: false
| NodeOptions
optimization
checkWasmTypes
: boolean
chunkIds
: false
| "natural"
| "named"
| "deterministic"
| "size"
| "total-size"
concatenateModules
: boolean
emitOnErrors
: boolean
flagIncludedChunks
: boolean
innerGraph
: boolean
mangleExports
: boolean
| "deterministic"
| "size"
mangleWasmImports
: boolean
mergeDuplicateChunks
: boolean
minimize
: boolean
minimizer
: ((function
, WebpackPluginInstance
, string
))[]moduleIds
: false
| "natural"
| "named"
| "deterministic"
| "size"
| "hashed"
noEmitOnErrors
: boolean
nodeEnv
: string
| false
portableRecords
: boolean
providedExports
: boolean
realContentHash
: boolean
removeAvailableModules
: boolean
removeEmptyChunks
: boolean
runtimeChunk
: boolean
| "single"
| "multiple"
| type
sideEffects
: boolean
| "flag"
splitChunks
: false
| OptimizationSplitChunksOptions
usedExports
: boolean
| "global"
output
assetModuleFilename
: string
| function
asyncChunks
: boolean
auxiliaryComment
: string
| LibraryCustomUmdCommentObject
charset
: boolean
chunkFilename
: string
| function
chunkFormat
: string
| false
chunkLoadTimeout
: number
chunkLoading
: string
| false
chunkLoadingGlobal
: string
clean
: boolean
| CleanOptions
compareBeforeEmit
: boolean
crossOriginLoading
: false
| "anonymous"
| "use-credentials"
cssChunkFilename
: string
| function
cssFilename
: string
| function
devtoolFallbackModuleFilenameTemplate
: string
| Function
devtoolModuleFilenameTemplate
: string
| Function
devtoolNamespace
: string
enabledChunkLoadingTypes
: string
[]enabledLibraryTypes
: string
[]enabledWasmLoadingTypes
: string
[]environment
: Environmentfilename
: string
| function
globalObject
: string
hashDigest
: string
hashDigestLength
: number
hashFunction
: string
| hashSalt
: string
hotUpdateChunkFilename
: string
hotUpdateGlobal
: string
hotUpdateMainFilename
: string
iife
: boolean
importFunctionName
: string
importMetaName
: string
library
: string
| string
[] | LibraryOptions
| LibraryCustomUmdObject
libraryExport
: string
| string
[]libraryTarget
: string
module
: boolean
path
: string
pathinfo
: boolean
| "verbose"
publicPath
: string
| function
scriptType
: false
| "module"
| "text/javascript"
sourceMapFilename
: string
sourcePrefix
: string
strictModuleErrorHandling
: boolean
strictModuleExceptionHandling
: boolean
trustedTypes
: string
| true
| TrustedTypes
umdNamedDefine
: boolean
uniqueName
: string
wasmLoading
: string
| false
webassemblyModuleFilename
: string
workerChunkLoading
: string
| false
workerWasmLoading
: string
| false
parallelism
: number
performance
: false
| PerformanceOptions
plugins
: ((function
, WebpackPluginInstance
))[]profile
: boolean
recordsInputPath
: string
| false
recordsOutputPath
: string
| false
recordsPath
: string
| false
resolve
alias
: type
[] | type
aliasFields
: ((string
, string
[]))[]byDependency
[string
]: ResolveOptionsWebpackOptionscache
: boolean
cachePredicate
: function (request
*: ) => boolean
cacheWithContext
: boolean
conditionNames
: string
[]descriptionFiles
: string
[]enforceExtension
: boolean
exportsFields
: string
[]extensions
: string
[]fallback
: type
[] | type
fileSystem
: InputFileSystemfullySpecified
: boolean
importsFields
: string
[]mainFields
: ((string
, string
[]))[]mainFiles
: string
[]modules
: string
[]plugins
: ((ResolvePluginInstance
, string
))[]preferAbsolute
: boolean
preferRelative
: boolean
resolver
: Resolverrestrictions
: ((string
, RegExp
))[]roots
: string
[]symlinks
: boolean
unsafeCache
: boolean
| type
useSyncFileSystemCalls
: boolean
resolveLoader
alias
: type
[] | type
aliasFields
: ((string
, string
[]))[]byDependency
[string
]: ResolveOptionsWebpackOptionscache
: boolean
cachePredicate
: function (request
*: ) => boolean
cacheWithContext
: boolean
conditionNames
: string
[]descriptionFiles
: string
[]enforceExtension
: boolean
exportsFields
: string
[]extensions
: string
[]fallback
: type
[] | type
fileSystem
: InputFileSystemfullySpecified
: boolean
importsFields
: string
[]mainFields
: ((string
, string
[]))[]mainFiles
: string
[]modules
: string
[]plugins
: ((ResolvePluginInstance
, string
))[]preferAbsolute
: boolean
preferRelative
: boolean
resolver
: Resolverrestrictions
: ((string
, RegExp
))[]roots
: string
[]symlinks
: boolean
unsafeCache
: boolean
| type
useSyncFileSystemCalls
: boolean
snapshot
buildDependencies
hash
*: timestamp
*: immutablePaths
: ((string
, RegExp
))[]managedPaths
: ((string
, RegExp
))[]module
hash
*: timestamp
*: resolve
hash
*: timestamp
*: resolveBuildDependencies
hash
*: timestamp
*: stats
: boolean
| StatsOptions
| "none"
| "verbose"
| "summary"
| "errors-only"
| "errors-warnings"
| "minimal"
| "normal"
| "detailed"
target
: string
| false
| string
[]watch
: boolean
watchOptions
aggregateTimeout
: number
followSymlinks
: boolean
ignored
: string
| RegExp
| string
[]poll
: number
| boolean
stdin
: boolean
devServer
: WebpackDevServer.Configuration
| undefined
| Options object as provided by the user. |
deepMergeWebpackConfig
function
deep merge two webpack configurations
defined in @component-controls/webpack-configs/core/webpack-configs/src/index.ts
parameters
| Name | Type