1.webpack config
module.exports = {
module: {
rules: [
{
test: /\.api$/,
include: [ srcPath ],
use: 'jjb-api-loader'
}
]
}
}
2.file example
index.api
// Login
Login Post args https://api.xxx.com/login
3.usage
import { Login } from './index.api';
// call
Login({
userName: 'xxx',
password: 'xxx'
}).then(res => console.log(res))