监控 mpvue

1. 接入插件

src/main.js中接入Fundebug而不是在app.js中接入Fundebug。

2. eslint忽略Fundebug报错

修改build/webpack.base.conf中的eslint-loader配置,添加exclude属性:

{
    test: /\.(js|vue)$/,
    loader: 'eslint-loader',
    enforce: 'pre',
    exclude: /fundebug/,
    include: [resolve('src'), resolve('test')],
    options:
    {
        formatter: require('eslint-friendly-formatter')
    }
}
3. 修改.babelrc的modules配置,由false改成commonjs
{
  "presets": [
    ["env", {
      "modules": "commonjs",
      "targets": {
        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }],
    "stage-2"
  ],
  "plugins": ["transform-runtime"],
  "env": {
    "test": {
      "presets": ["env", "stage-2"],
      "plugins": ["istanbul"]
    }
  }
}

小程序形式上是支持commonjs的,所以这样改没问题,可以避免出现Cannot assign to read only property 'exports' of object报错。

results matching ""

    No results matching ""