Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): 修复组件打包后入口文件路径 #1177

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ const config = {
designWidth: 750,
sourceRoot: 'src',
outputRoot: isBuildComponent ? 'dist' : `dist/${process.env.TARO_ENV}`,
plugins: {},
plugins: ['@tarojs/plugin-sass', '@tarojs/plugin-uglify'],
babel: {
sourceMap: true,
presets: [
'env'
],
presets: ['env'],
plugins: [
'transform-class-properties',
'transform-decorators-legacy',
Expand All @@ -23,7 +21,7 @@ const config = {
},
defineConstants: {},
alias: {
'taro-ui': path.resolve(__dirname, '../src/ui.ts'),
'taro-ui': path.resolve(__dirname, '../src/ui.ts')
},
mini: {},
h5: {
Expand All @@ -33,7 +31,7 @@ const config = {
enable: true
}
}
},
}
}

if (isBuildComponent) {
Expand All @@ -57,22 +55,24 @@ if (isBuildComponent) {
classnames: 'commonjs2 classnames',
'@tarojs/components': 'commonjs2 @tarojs/components',
'@tarojs/taro-h5': 'commonjs2 @tarojs/taro-h5',
'weui': 'commonjs2 weui'
weui: 'commonjs2 weui'
},
plugin: {
extractCSS: {
plugin: MiniCssExtractPlugin,
args: [{
filename: 'css/index.css',
chunkFilename: 'css/[id].css'
}]
args: [
{
filename: 'css/index.css',
chunkFilename: 'css/[id].css'
}
]
}
}
})
}
}

module.exports = function (merge) {
module.exports = function(merge) {
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'))
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"build:h5": "taro build --type h5",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
"build:component": "cross-env TARO_BUILD_TYPE=component taro build --ui",
"build:component": "cross-env TARO_BUILD_TYPE=component taro build --ui --uiIndex ui",
"build:h5-static": "yarn run build:h5 && node ./build/build-static",
"build:doc": "yarn run build:h5-static && node ./build/build-docs",
"prepublishOnly": "yarn run clean && yarn run build:component",
Expand Down Expand Up @@ -234,7 +234,7 @@
"@tarojs/plugin-babel": "^2.0.3",
"@tarojs/plugin-csso": "^2.0.3",
"@tarojs/plugin-sass": "^2.0.3",
"@tarojs/plugin-uglifyjs": "^2.0.3",
"@tarojs/plugin-uglify": "^2.2.10",
"@tarojs/router": "^2.0.3",
"@tarojs/taro": "^2.0.3",
"@tarojs/taro-alipay": "^2.0.3",
Expand Down