mini-program-loader
mini program loader for webpack, forked from wxapp-boilerplate, added support for Baidu smart app.
Installation
yarn add -D @lucashc/mini-program-loader
Usage
You may also need to use file-loader to extract files.
{
test: /\.wxml$/,
include: /src/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
useRelativePath: true,
context: resolve('src'),
},
},
{
loader: '@lucashc/mini-program-loader-loader',
options: {
root: resolve('src'),
enforceRelativePath: true,
},
},
],
}
Options
-
root
(String): Root path for requiring sources -
enforceRelativePath
(Boolean): Should be true if you wish to generate aroot
relative URL for each file. It is recommend to set totrue
-
publicPath
(String): Defaults to webpack output.publicPath -
transformContent(content, resource)
(Function): Transform content, should return a content string -
transformUrl(url, resource)
(Function): Transform url, should return a url -
minimize
(Boolean): To minimize. Defaults tofalse
- All html-minifier options are supported
License
MIT