mpvue中使用rpx

mpvue中使用rpx

引用px2rpx-loader

// utils.js  34行   px2rpxLoader
var path = require('path')
var fs = require('fs')
var config = require('../config')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var mpvueInfo = require('../node_modules/mpvue/package.json')
var packageInfo = require('../package.json')
var mkdirp = require('mkdirp')

exports.assetsPath = function (_path) {
  var assetsSubDirectory = process.env.NODE_ENV === 'production'
    ? config.build.assetsSubDirectory
    : config.dev.assetsSubDirectory
  return path.posix.join(assetsSubDirectory, _path)
}

exports.cssLoaders = function (options) {
  options = options || {}

  var cssLoader = {
    loader: 'css-loader',
    options: {
      minimize: process.env.NODE_ENV === 'production',
      sourceMap: options.sourceMap
    }
  }

  var postcssLoader = {
    loader: 'postcss-loader',
    options: {
      sourceMap: true
    }
  }

  var px2rpxLoader = {
    loader: 'px2rpx-loader',
    options: {
      baseDpr: 1,
      rpxUnit: 0.5
    }
  }

最后查看.postcssec.js文件是否有别的适配方案,没有的话就OK了

你可能感兴趣的:(小程序升华之路,小程序)