提交 12978acd 编写于 作者: fxy060608's avatar fxy060608

feat(h5): renderjs

上级 4b4d5e1f
...@@ -89,13 +89,6 @@ const v3 = { ...@@ -89,13 +89,6 @@ const v3 = {
loader: path.resolve(__dirname, loader: path.resolve(__dirname,
'../../packages/webpack-uni-app-loader/view/script') '../../packages/webpack-uni-app-loader/view/script')
}) })
// view 层 renderjs
// rules.push({
// resourceQuery: [/lang=renderjs/, /blockType=renderjs/],
// use: [{
// loader: path.resolve(__dirname, '../../packages/webpack-uni-app-loader/view/renderjs')
// }]
// })
} }
scriptLoaders.push({ scriptLoaders.push({
loader: path.resolve(__dirname, loader: path.resolve(__dirname,
......
...@@ -28,6 +28,7 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api) ...@@ -28,6 +28,7 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api)
.use('vue-loader') .use('vue-loader')
.loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vue-loader')) .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vue-loader'))
.tap(options => Object.assign(options, { .tap(options => Object.assign(options, {
isH5: process.env.UNI_PLATFORM === 'h5',
compiler: getPlatformCompiler(), compiler: getPlatformCompiler(),
compilerOptions: Object.assign({ compilerOptions: Object.assign({
isUnaryTag, isUnaryTag,
...@@ -35,11 +36,11 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api) ...@@ -35,11 +36,11 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api)
}, compilerOptions) }, compilerOptions)
}, cacheConfig)) }, cacheConfig))
.end() .end()
// .use('uniapp-custom-block-loader') // .use('uniapp-custom-block-loader')
// .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader')) // .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
// .options({ // .options({
// compiler: getPlatformCompiler() // compiler: getPlatformCompiler()
// }) // })
// h5 框架需要使用 scoped 样式,其他平台编译时识别是否 nvue 文件且注入 flex 相关样式 // h5 框架需要使用 scoped 样式,其他平台编译时识别是否 nvue 文件且注入 flex 相关样式
if (process.env.UNI_PLATFORM === 'h5') { if (process.env.UNI_PLATFORM === 'h5') {
......
...@@ -142,7 +142,7 @@ module.exports = function (source) { ...@@ -142,7 +142,7 @@ module.exports = function (source) {
} }
let renderjsImport = `var renderjs` let renderjsImport = `var renderjs`
if(options.isAppView && descriptor.renderjs){ if((options.isAppView || options.isH5) && descriptor.renderjs){
const src = descriptor.renderjs.src || resourcePath const src = descriptor.renderjs.src || resourcePath
const attrsQuery = attrsToQuery(descriptor.renderjs.attrs, 'js') const attrsQuery = attrsToQuery(descriptor.renderjs.attrs, 'js')
const query = `?vue&type=renderjs${attrsQuery}${inheritQuery}` const query = `?vue&type=renderjs${attrsQuery}${inheritQuery}`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册