提交 a17ec656 编写于 作者: Q qiang

fix: nvue-native template

上级 d9d0300b
......@@ -30,7 +30,8 @@ const {
removeExt,
normalizePath,
getComponentName,
convertStaticStyle
convertStaticStyle,
getTemplatePath
} = require('./util')
const {
......@@ -102,6 +103,7 @@ module.exports = {
parseManifestJson,
getComponentName,
convertStaticStyle,
getTemplatePath,
jsPreprocessOptions,
cssPreprocessOptions,
htmlPreprocessOptions,
......
......@@ -115,5 +115,8 @@ module.exports = {
return str.replace('wx-', 'weixin-')
}
return str
})
}),
getTemplatePath () {
return path.join(__dirname, '../template')
}
}
......@@ -8,7 +8,8 @@ const {
getNVueMainEntry,
nvueJsPreprocessOptions,
nvueHtmlPreprocessOptions,
devtoolModuleFilenameTemplate
devtoolModuleFilenameTemplate,
getTemplatePath
} = require('@dcloudio/uni-cli-shared')
const WebpackAppPlusNVuePlugin = require('../packages/webpack-app-plus-nvue-plugin')
......@@ -161,23 +162,39 @@ rules.unshift({
if (process.env.UNI_USING_NATIVE) {
plugins.push(new WebpackUniMPPlugin())
let nativeTemplatePath = path.resolve(
const array = [{
from: path.resolve(process.env.UNI_INPUT_DIR, 'static'),
to: 'static'
}]
if (process.env.UNI_USING_NVUE_COMPILER) {
array.push({
from: path.resolve(getTemplatePath(), 'common'),
to: process.env.UNI_OUTPUT_DIR
}, {
from: path.resolve(
process.env.UNI_HBUILDERX_PLUGINS,
'weapp-tools/template/v8-native'
)
'weapp-tools/template/common'
),
to: process.env.UNI_OUTPUT_DIR,
ignore: [
'*.js',
'*.json',
'__uniapppicker.html',
'__uniappview.html',
'__uniappmarker@3x.png',
'__uniappopenlocation.html',
'__uniapppicker.html'
]
})
} else {
let nativeTemplatePath = path.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'weapp-tools/template/v8-native')
if (!fs.existsSync(nativeTemplatePath)) { // 兼容旧版本
nativeTemplatePath = path.resolve(
process.env.UNI_HBUILDERX_PLUGINS,
'weapp-tools/template/v8'
)
}
plugins.push(new CopyWebpackPlugin([{
from: path.resolve(process.env.UNI_INPUT_DIR, 'static'),
to: 'static'
}, {
array.push({
from: nativeTemplatePath,
to: process.env.UNI_OUTPUT_DIR
}, {
......@@ -192,7 +209,9 @@ if (process.env.UNI_USING_NATIVE) {
'__uniapppicker.html',
'__uniappview.html'
]
}]))
})
}
plugins.push(new CopyWebpackPlugin(array))
}
module.exports = function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册