waya-webpack-dev
v0.0.5
Published
webpack dev tools for waya
Downloads
6
Readme
Default
const DEFAULT_EXTENSIONS
const DEFAULT_EXTENSIONS: string[]
default file extensions for webpack resolver, default to:
js
,mjs
ts
,tsx
json
function createDefaultConfig
function createDefaultConfig(
options: DefaultConfigOptions
): webpack.Configuration
create default config for dev mode. includes:
- set
mode
todevelopment
- set
context
to project root - set
@
alias for project root - set
ts
/tsx
for extension free resolve - set
devtool
toinline-source-map
for sourcemap debug - append
modulesContext
for modules search path - add
webpack.HotModuleReplacementPlugin
plugin to enable HMR feature - set
output.publicPath
to/
for history fallback.
interface DefaultConfigOptions
interface DefaultConfigOptions {
context: string
name?: string
modulesContext?: string
}
name
was the compiler name, default toapp
Script
function createScriptConfig
function createScriptConfig(): webpack.Configuration
create 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.RuleSetUse
just apply url-loader for load image resources.
function createImageConfig
function createImageConfig(options: ImageConfigOptions): webpack.Configuration
setup 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.Configuration
create 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.Configuration
create 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.