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

修改代码,保存后,提示编译成功,但是打开开发者工具,依旧是旧代码 #5214

Closed
vivinbear opened this issue Dec 30, 2019 · 6 comments
Assignees

Comments

@vivinbear
Copy link

vivinbear commented Dec 30, 2019

问题描述

复现步骤

/**
 * 这段注释后可以贴代码
 * 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间
 * 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】
 * 
 * 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5
 */
package.json
{
	"name": "xbrepoapp",
	"version": "1.0.0",
	"private": true,
	"description": "Xuebaox Repo",
	"templateInfo": {
		"name": "default",
		"typescript": false,
		"css": "less"
	},
	"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",
		"build:qq": "taro build --type qq",
		"build:quickapp": "taro build --type quickapp",
		"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",
		"dev:qq": "npm run build:qq -- --watch",
		"dev:quickapp": "npm run build:quickapp -- --watch"
	},
	"author": "",
	"license": "MIT",
	"dependencies": {
		"@tarojs/components": "2.0.0-beta.12",
		"@tarojs/mini-runner": "2.0.0-beta.12",
		"@tarojs/redux": "^1.3.32",
		"@tarojs/redux-h5": "^1.3.32",
		"@tarojs/router": "2.0.0-beta.12",
		"@tarojs/taro": "2.0.0-beta.12",
		"@tarojs/taro-alipay": "2.0.0-beta.12",
		"@tarojs/taro-h5": "2.0.0-beta.12",
		"@tarojs/taro-qq": "2.0.0-beta.12",
		"@tarojs/taro-quickapp": "2.0.0-beta.12",
		"@tarojs/taro-swan": "2.0.0-beta.12",
		"@tarojs/taro-tt": "2.0.0-beta.12",
		"@tarojs/taro-weapp": "2.0.0-beta.12",
		"babel-runtime": "^6.26.0",
		"dva-core": "^2.0.2",
		"dva-loading": "^3.0.20",
		"lodash": "^4.17.15",
		"mobx": "^4.8.0",
		"moment": "^2.24.0",
		"nerv-devtools": "^1.5.6",
		"nervjs": "^1.5.6",
		"redux": "^4.0.5",
		"redux-logger": "^3.0.6",
		"redux-thunk": "^2.3.0",
		"taro-skeleton": "^1.0.13",
		"taro-ui": "^2.2.4"
	},
	"devDependencies": {
		"@tarojs/plugin-babel": "2.0.0-beta.12",
		"@tarojs/plugin-csso": "2.0.0-beta.12",
		"@tarojs/plugin-less": "2.0.0-beta.12",
		"@tarojs/plugin-uglifyjs": "2.0.0-beta.12",
		"@tarojs/webpack-runner": "2.0.0-beta.12",
		"@types/react": "^16.4.6",
		"@types/webpack-env": "^1.13.6",
		"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-plugin-transform-runtime": "^6.23.0",
		"babel-preset-env": "^1.6.1",
		"eslint": "^5.16.0",
		"eslint-config-taro": "1.3.27",
		"eslint-plugin-import": "^2.12.0",
		"eslint-plugin-react": "^7.8.2",
		"eslint-plugin-react-hooks": "^1.6.1",
		"eslint-plugin-taro": "1.3.27",
		"stylelint": "9.3.0",
		"stylelint-config-taro-rn": "1.3.27",
		"stylelint-taro-rn": "1.3.27",
		"taro-iconfont-cli": "^1.0.5"
	}
}
config->index.js
const config = {
  projectName: 'test',
  date: '2019-11-16',
  designWidth: 750,
  deviceRatio: {
    '640': 2.34 / 2,
    '750': 1,
    '828': 1.81 / 2
  },
  sourceRoot: 'src',
  outputRoot: 'dist',
  babel: {
    sourceMap: true,
    presets: [
      'env'
    ],
    plugins: [
      'transform-class-properties',
      'transform-decorators-legacy',
      'transform-object-rest-spread',
      ['transform-runtime', {
        "helpers": false,
        "polyfill": false,
        "regenerator": true,
        "moduleName": 'babel-runtime'
      }]
    ]
  },
  defineConstants: {
  },
  mini: {
    postcss: {
      pxtransform: {
        enable: true,
        config: {

        }
      },
      url: {
        enable: true,
        config: {
          limit: 10240 // 设定转换尺寸上限
        }
      },
      cssModules: {
        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
        config: {
          namingPattern: 'module', // 转换模式,取值为 global/module
          generateScopedName: '[name]__[local]___[hash:base64:5]'
        }
      }
    }
  },
  h5: {
    publicPath: '/',
    staticDirectory: 'static',
    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]'
          }
        }
      }
    }
  }
}

module.exports = function (merge) {
  if (process.env.NODE_ENV === 'development') {
    return merge({}, config, require('./dev'))
  }
  return merge({}, config, require('./prod'))
}

期望行为

修改代码后,保存后,应该热更新

报错信息

但实际提示了编译成功,开发者工具却不是新代码,还是旧的

系统信息

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Dec 30, 2019

CC @luckyadam

@taro-bot
Copy link

taro-bot bot commented Dec 30, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam
Copy link
Member

改了什么代码

@luckyadam
Copy link
Member

给一下复现的步骤

@vivinbear
Copy link
Author

不知道是么原因,我按照2.0的cli构建出来的config改了一下,目前好了 估计很大可能是我的问题,但我不确定是哪里但问题

@jovicheng
Copy link

应该是这个issue:
#5140
从2.0.0@beta-8 就有这个问题 现在(beta12)貌似还会存在
工作辛苦了

@luckyadam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants