0.0.1 • Published 5 years ago
@ytu-mf/ytu-muti-page-plugin v0.0.1
@ytu-mf/ytu-config-plugin
a webpack plugin for download ytuH5 project config file in Server
Get start
npm install @ytu-mf/ytu-config-plugin
How to use
const YtuConfigPlugin = require('@ytu-mf/ytu-config-plugin');
const config = {
    plugins: [
        new YtuConfigPlugin(),
    ]
}use it in dev Mode in principle, and don't forget set your fold in .gitigore, because these files no need to appear on the server,Only available for viewing when developing a project
Options
outputPath
your output fold name , default Value: 'ytuConfig'
example:
const config = {
    plugins: [
        new YtuConfigPlugin({
            outputPath: 'devConfig'
        }),
    ]
}successStatus
your request success status code,default Value: 200
when you set it, All values in the fileArr array that do not have the successStatus attribute set will default to this value
example:
const config = {
    plugins: [
        new YtuConfigPlugin({
            successStatus: 201,
            fileArr: [
            {
                // successStatus: 201 It's equivalent to this
                filename: 'specialConfig.json',
                axios: {
                    url: 'http://uat.yuantutech.com/tms/h5/special-config.php',
                    params: {
                        dataType: 'json',
                    },
                },
            },
            ],
        }),
    ]
}fileArr
your request Arr, default Value:
{
    filename: "specialConfig.json",
    axios: {
    url: "http://uat.yuantutech.com/tms/h5/special-config.php",
    params: {
        dataType: "json",
    },
    },
},
{
    filename: "ytuIcons.json",
    axios: {
    url: "http://uat.yuantutech.com/tms/h5/icons.php",
    params: {
        dataType: "json",
    },
    },
},filename
file name for request result
successStatus
this request success status
when you set successStatus outSize, will be based on internal values
example:
const config = {
    plugins: [
        new YtuConfigPlugin({
            successStatus: 201,
            fileArr: [
            {
                filename: 'specialConfig.json',
                successStatus: 200, // base on this value
                axios: {
                url: 'http://uat.yuantutech.com/tms/h5/special-config.php',
                params: {
                    dataType: 'json',
                },
                },
            },
            ],
        }),
    ]
}axios
Options for your request ,same as axios
0.0.1
5 years ago