Readme
English | 简体中文
A h5 debug plugin for eruda and vConsole.
yarn add local-mock-h5
// #!if ENV === "development"
import eruda from 'eruda'
import { erudaLocalMock } from 'local-mock-h5'
eruda.init()
const localMockplugin = erudaLocalMock(eruda, {
state: '0',
proxy: 'http://localhost:8080',
})
eruda.add(localMockplugin)
// #!endif
// #!if ENV === "development"
import VConsole from 'vconsole'
import { vconsoleLocalMock } from 'local-mock-h5'
const vconsole = new VConsole()
const localMockplugin = vconsoleLocalMock(VConsole, {
state: '0',
proxy: 'http://localhost:8080',
})
vconsole.addPlugin(localMockplugin)
// #!endif
devServer
Since the entry file of 'devServer' is loaded in the domain name, you need to configure cross-origin and configure publicPath to load local static resources.
{
"devServer": {
"publicPath": "http://localhost:8080",
"port": 8080,
"headers": {
"Access-Control-Allow-Origin": "*"
}
}
}
publicPath
and proxy
change to http://{ip}:{port}
, such as: http://192.168.1.10:8080
Because the page resources of lcoalhost:8080 cannot be accessed on the mobile machine
FAQs
A h5 debug plugin for eruda and vConsole.
We found that local-mock-h5 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.