提交 25bba0c9 编写于 作者: fxy060608's avatar fxy060608

fix(wxs): base64(wxs code)

上级 e18bd5bf
......@@ -62,7 +62,7 @@ module.exports = function parseCustomBlocks(descriptor, options) {
filterModule.attrs.src = normalizeNodeModules(filterModule.attrs.src)
}
})
descriptor.template.attrs['filter-modules'] = JSON.stringify(filterModules)
descriptor.template.attrs['filter-modules'] = Buffer.from(JSON.stringify(filterModules)).toString('base64')
}
return descriptor
......
const loaderUtils = require('loader-utils')
module.exports = function (content) {
function parseFilterModules(filterModules) {
if (filterModules) {
return JSON.parse(Buffer.from(filterModules, 'base64').toString('ascii'))
}
return {}
}
module.exports = function(content) {
this.cacheable && this.cacheable()
const vueLoaderOptions = this.loaders.find(loader => loader.ident === 'vue-loader-options')
if (vueLoaderOptions) {
const params = loaderUtils.parseQuery(this.resourceQuery)
/* eslint-disable no-mixed-operators */
const filterModules = JSON.parse(params && params['filter-modules'] || '{}')
const filterModules = parseFilterModules(params && params['filter-modules'])
Object.assign(vueLoaderOptions.options.compilerOptions, {
filterModules: Object.keys(filterModules)
})
......
......@@ -28,6 +28,13 @@ const {
const templateExt = getPlatformExts().template
const filterTagName = getPlatformFilterTag() || ''
function parseFilterModules (filterModules) {
if (filterModules) {
return JSON.parse(Buffer.from(filterModules, 'base64').toString('ascii'))
}
return {}
}
module.exports = function (content) {
this.cacheable && this.cacheable()
......@@ -41,7 +48,7 @@ module.exports = function (content) {
const params = loaderUtils.parseQuery(this.resourceQuery)
/* eslint-disable no-mixed-operators */
const filterModules = JSON.parse(params && params['filter-modules'] || '{}')
const filterModules = parseFilterModules(params && params['filter-modules'])
Object.assign(vueLoaderOptions.options.compilerOptions, {
mp: {
platform: process.env.UNI_PLATFORM
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册