提交 a17ec656 编写于 作者: Q qiang

fix: nvue-native template

上级 d9d0300b
......@@ -13,7 +13,7 @@ const {
} = require('./manifest.js')
const {
getMainEntry,
getMainEntry,
getNVueMainEntry,
parseEntry,
parsePages,
......@@ -28,36 +28,37 @@ const {
camelize,
hyphenate,
removeExt,
normalizePath,
normalizePath,
getComponentName,
convertStaticStyle
convertStaticStyle,
getTemplatePath
} = require('./util')
const {
getFlexDirection,
getPlatformProject,
const {
getFlexDirection,
getPlatformProject,
isSupportSubPackages,
getPlatforms,
getPlatforms,
getPlatformGlobal,
getPlatformScss,
getPlatformScss,
getPlatformSass,
runByHBuilderX,
isInHBuilderX,
runByHBuilderX,
isInHBuilderX,
isInHBuilderXAlpha,
getPlatformExts,
getPlatformTarget,
getPlatformVue,
getPlatformCompiler,
getPlatformCompiler,
getShadowCss,
getPlatformCssVars,
getPlatformCssnano,
getPlatformCssVars,
getPlatformCssnano,
getShadowTemplate,
jsPreprocessOptions,
cssPreprocessOptions,
htmlPreprocessOptions,
nvueJsPreprocessOptions,
nvueJsPreprocessOptions,
nvueCssPreprocessOptions,
nvueHtmlPreprocessOptions,
nvueHtmlPreprocessOptions,
devtoolModuleFilenameTemplate
} = require('./platform')
......@@ -75,38 +76,39 @@ module.exports = {
parseEntry,
parsePages,
getH5Options,
getMainEntry,
getMainEntry,
getNVueMainEntry,
getPagesJson,
getManifestJson,
getNetworkTimeout,
runByHBuilderX,
isInHBuilderX,
isInHBuilderXAlpha,
runByHBuilderX,
isInHBuilderX,
isInHBuilderXAlpha,
isSupportSubPackages,
getPlatforms,
getPlatforms,
getFlexDirection,
getPlatformScss,
getPlatformScss,
getPlatformSass,
getPlatformExts,
getPlatformTarget,
getPlatformTarget,
getPlatformProject,
getPlatformVue,
getPlatformGlobal,
getPlatformVue,
getPlatformGlobal,
getShadowCss,
getPlatformCssVars,
getPlatformCssVars,
getPlatformCssnano,
getPlatformCompiler,
getPlatformCompiler,
getShadowTemplate,
parsePagesJson,
parseManifestJson,
parseManifestJson,
getComponentName,
convertStaticStyle,
getTemplatePath,
jsPreprocessOptions,
cssPreprocessOptions,
htmlPreprocessOptions,
nvueJsPreprocessOptions,
nvueJsPreprocessOptions,
nvueCssPreprocessOptions,
nvueHtmlPreprocessOptions,
nvueHtmlPreprocessOptions,
devtoolModuleFilenameTemplate
}
......@@ -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')
......@@ -95,7 +96,7 @@ const rules = [{
babelrc: false
}
},
jsPreprocessorLoader
jsPreprocessorLoader
],
exclude (modulePath) {
return excludeModuleReg.test(modulePath) && modulePath.indexOf('@dcloudio') === -1
......@@ -161,38 +162,56 @@ rules.unshift({
if (process.env.UNI_USING_NATIVE) {
plugins.push(new WebpackUniMPPlugin())
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([{
const array = [{
from: path.resolve(process.env.UNI_INPUT_DIR, 'static'),
to: 'static'
}, {
from: nativeTemplatePath,
to: process.env.UNI_OUTPUT_DIR
}, {
from: path.resolve(
process.env.UNI_HBUILDERX_PLUGINS,
'weapp-tools/template/common'
),
to: process.env.UNI_OUTPUT_DIR,
ignore: [
'*.js',
'*.json',
'__uniapppicker.html',
'__uniappview.html'
]
}]))
}]
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/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'
)
}
array.push({
from: nativeTemplatePath,
to: process.env.UNI_OUTPUT_DIR
}, {
from: path.resolve(
process.env.UNI_HBUILDERX_PLUGINS,
'weapp-tools/template/common'
),
to: process.env.UNI_OUTPUT_DIR,
ignore: [
'*.js',
'*.json',
'__uniapppicker.html',
'__uniappview.html'
]
})
}
plugins.push(new CopyWebpackPlugin(array))
}
module.exports = function () {
......@@ -296,4 +315,4 @@ module.exports = function () {
zlib: false
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册