Closed ztfstar closed 4 years ago
没有复现,你项目依赖里有些 taro 包的版本是旧的
@luckyadam taro的依赖更新是按照咱们文档上更新的,taro的依赖会影响插件的运行吗? @luckyadam `const config = { projectName: 'library-miniprogram', date: '2019-10-30', designWidth: 750, deviceRatio: { '640': 2.34 / 2, '750': 1, '828': 1.81 / 2 }, sourceRoot: 'src', outputRoot: 'dist', alias: { '@/components': path.resolve(dirname, '..', 'src/components'), '@/utils': path.resolve(dirname, '..', 'src/utils'), '@/pages': path.resolve(dirname, '..', 'src/pages'), '@/store': path.resolve(dirname, '..', 'src/store'), '@/api': path.resolve(__dirname, '..', 'src/api'),
},
plugins: {
babel: {
sourceMap: true,
presets: [
['env', {
modules: false
}]
],
plugins: [
'transform-decorators-legacy',
'transform-class-properties',
'transform-object-rest-spread'
]
}
},
defineConstants: {
},
copy: {
patterns: [
],
options: {
}
},
terser: {
enable: true,
},
mini: {
webpackChain (chain, webpack) {
chain.plugin('analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
},
module: {
postcss: {
autoprefixer: {
enable: false,
config: {
browsers: [
'last 3 versions',
'Android >= 5',
'ios >= 10'
]
}
},
pxtransform: {
enable: true,
config: {
}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
}
},
h5: {
publicPath: '/',
staticDirectory: 'static',
esnextModules: ['taro-ui'],
router: {
mode: 'browser' // 或者是 'browser'
},
module: {
postcss: {
autoprefixer: {
enable: true,
config: {
browsers: [
'last 3 versions',
'Android >= 4.1',
'ios >= 8'
]
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
}
}
}`
Taro CLI 和项目依赖的版本保持一致
@luckyadam 大佬,这块的文档说明 https://taro-docs.jd.com/taro/docs/migrate-to-2/#%E5%85%A8%E5%B1%80-cli-%E5%8D%87%E7%BA%A7 404了
@luckyadam 大佬 ,我这边"@tarojs/cli": "1.3.35",和"@tarojs/taro-weapp": "1.3.35",版本一样的
{ "name": "library-miniprogram", "version": "1.1.5", "private": true, "description": "图书馆小程序", "templateInfo": { "name": "mobx", "typescript": true, "css": "sass" }, "main": "index.js", "scripts": { "build:weapp": "taro build --type weapp", "build:swan": "taro build --type swan", "build:alipay": "taro build --type alipay", "build:tt": "taro build --type tt", "build:h5": "taro build --type h5", "build:rn": "taro build --type rn", "dev:weapp": "npm run build:weapp -- --watch", "dev:swan": "npm run build:swan -- --watch", "dev:alipay": "npm run build:alipay -- --watch", "dev:tt": "npm run build:tt -- --watch", "dev:h5": "npm run build:h5 -- --watch", "dev:rn": "npm run build:rn -- --watch" }, "author": "", "license": "MIT", "dependencies": { "@tarojs/async-await": "1.3.35", "@tarojs/components": "^3.0.8", "@tarojs/mini-runner": "^3.0.8", "@tarojs/mobx": "1.3.35", "@tarojs/mobx-h5": "1.3.35", "@tarojs/mobx-rn": "1.3.35", "@tarojs/react": "^3.0.8", "@tarojs/rn-runner": "1.3.35", "@tarojs/router": "1.3.35", "@tarojs/runtime": "^3.0.8", "@tarojs/taro": "^3.0.8", "@tarojs/taro-alipay": "1.3.35", "@tarojs/taro-h5": "1.3.35", "@tarojs/taro-swan": "1.3.35", "@tarojs/taro-tt": "1.3.35", "@tarojs/taro-weapp": "1.3.35", "@xmly/xlog-xmlite": "^1.0.0-rc.0", "classnames": "^2.2.6", "eslint-config-prettier": "^6.7.0", "eslint-plugin-prettier": "^3.1.1", "mobx": "4.8.0", "mobx-react": "^6.1.4", "nerv-devtools": "^1.5.6", "nervjs": "^1.5.7", "prettier": "^1.19.1", "react": "^16.13.1", "taro-listview": "^1.1.11", "taro-ui": "^2.2.4" }, "devDependencies": { "@tarojs/cli": "1.3.35", "@tarojs/plugin-babel": "1.3.35", "@tarojs/plugin-csso": "1.3.35", "@tarojs/plugin-sass": "1.3.35", "@tarojs/plugin-uglifyjs": "1.3.35", "@tarojs/webpack-runner": "1.3.35", "@types/react": "16.3.14", "@types/webpack-env": "^1.13.6", "@typescript-eslint/eslint-plugin": "^2.10.0", "@typescript-eslint/parser": "^2.10.0", "babel-eslint": "^8.2.3", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-jsx-stylesheet": "^0.6.5", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.6.1", "eslint": "^5.16.0", "eslint-config-taro": "1.3.35", "eslint-plugin-import": "^2.12.0", "eslint-plugin-react": "^7.8.2", "eslint-plugin-react-hooks": "^1.6.1", "eslint-plugin-taro": "1.3.35", "husky": "^3.1.0", "lint-staged": "^9.5.0", "stylelint": "9.3.0", "stylelint-config-taro-rn": "1.3.35", "stylelint-taro-rn": "1.3.35", "typescript": "^3.0.1", "webpack-bundle-analyzer": "^3.8.0" }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "src/*/.{js,jsx,ts,tsx,css,scss,json,md}": [ "prettier --write", "git add" ] } }
没有复现这个问题,希望可以提供个 demo 看看
建议用3.0.8创建项目,然后把页面代码迁移过去。可以减少配置上的问题。
@jenerse 谢谢
同没有复现,再检查下吧。
相关平台
微信小程序
小程序基础库: 2.5.2 使用框架: React
复现步骤
升级到3.0.8后,启动yarn dev:weapp命令运行后,webpack-bundle-analyzer插件不能正常运行。
期望结果
webpack-bundle-analyzer插件正常运行
实际结果
webpack-bundle-analyzer插件不能正常运行
环境信息