亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

升級 Preact 版本后調試無法正常工作

升級 Preact 版本后調試無法正常工作

倚天杖 2022-11-27 16:19:25
我在調試我的 preact 項目時遇到了一些問題,大多數 js 錯誤都沒有出現在控制臺中。例如,我將這段代碼添加到我的組件中:<button onClick={() => {  const someVar = someUnknownVariable;}}>  fire error</button>當我點擊按鈕時,沒有出現錯誤,說 someUnknownVariable is not defined,其他 js 錯誤也沒有出現。這是我的 preact.config.js 文件:import compose from 'lodash.compose';export default (config, env, helpers) => {  return compose(addEmotionPlugin, configRules)(config, env, helpers);};function addEmotionPlugin(config) {  let babel = config.module.rules.filter(loader => loader.loader === 'babel-loader')[0]    .options;  babel.plugins.push([    'emotion',    {      hoist: true,      sourceMap: false,      autoLabel: true,      labelFormat: '[local]',      extractStatic: false,      outputDir: '',    },  ]);  return config;}function configRules(config, env) {  if (env.isProd) {    config.devtool = 'source-map';    config.output.filename = '[name].js';    config.output.publicPath = process.env.NODE_ASSETS || '/';  }  return config;}在我的 index.js 文件中,我在開頭有這段代碼。if (process.env.NODE_ENV==='development') {  require("preact/debug");}這是在我升級 preact 版本后發生的,請提供任何幫助。
查看完整描述

1 回答

?
夢里花落0921

TA貢獻1772條經驗 獲得超6個贊

問題出在舊的 eventListener 上,錯誤window.addEventListener('error', function(event) {});導致預調試問題,當我刪除它時,問題就解決了



查看完整回答
反對 回復 2022-11-27
  • 1 回答
  • 0 關注
  • 109 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號