0.0.5 • Published 6 years ago
waya-webpack-dev v0.0.5
Default
const DEFAULT_EXTENSIONS
const DEFAULT_EXTENSIONS: string[]default file extensions for webpack resolver, default to:
js,mjsts,tsxjson
function createDefaultConfig
function createDefaultConfig(
options: DefaultConfigOptions
): webpack.Configurationcreate default config for dev mode. includes:
- set
modetodevelopment - set
contextto project root - set
@alias for project root - set
ts/tsxfor extension free resolve - set
devtooltoinline-source-mapfor sourcemap debug - append
modulesContextfor modules search path - add
webpack.HotModuleReplacementPluginplugin to enable HMR feature - set
output.publicPathto/for history fallback.
interface DefaultConfigOptions
interface DefaultConfigOptions {
context: string
name?: string
modulesContext?: string
}namewas the compiler name, default toapp
Script
function createScriptConfig
function createScriptConfig(): webpack.Configurationcreate script config for dev mode, use ts-loader only.
const DEFAULT_IMAGE_EXTENSIONS
const DEFAULT_IMAGE_EXTENSIONS: string[]image extensions for resolver. default to:
- jpg, jpeg
- png
- gif
- webp
- svg
function createImageLoaderUse
function createImageLoaderUse(): webpack.RuleSetUsejust apply url-loader for load image resources.
function createImageConfig
function createImageConfig(options: ImageConfigOptions): webpack.Configurationsetup image loader rules.
interface ImageConfigOptions
interface ImageConfigOptions {
context: string
}context- image resources directory, only can load image file under this context.
Icon
function createIconConfig
function createIconConfig(options: IconConfigOptions): webpack.Configurationcreate icon config. icon was set of svg files.
interface IconConfigOptions
interface IconConfigOptions {
context: string
}context- svg sources directory, only can load svg file under this context directory.
I18n
function createI18nConfig
function createI18nConfig(options: I18nConfigOptions): webpack.Configurationcreate i18n config. locales file was set of yaml files.
interface I18nConfigOptions
interface I18nConfigOptions {
context: string
}context- i18n locales directory, only can load locales file under the context directory.