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

使用moment-timezone,微信小程序无法编译 #15942

Open
ajune0527 opened this issue Jun 20, 2024 · 0 comments
Open

使用moment-timezone,微信小程序无法编译 #15942

ajune0527 opened this issue Jun 20, 2024 · 0 comments

Comments

@ajune0527
Copy link

相关平台

微信小程序

小程序基础库: 3.3.4
使用框架: React

复现步骤

import {useEffect} from 'react';
import {View} from '@tarojs/components';
import moment from 'moment-timezone';


export default function Index() {
	
	useEffect(() => {
	}, []);
	return (
		<>
			
			<View style={{position: 'absolute', top: '20%', left: '40%'}}>
				{moment.tz('Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss')}
			</View>
		
		
		</>
	)
}

期望结果

正常显示页面

实际结果

模拟器console输出
app.js错误:
Error: Cannot find module './latest-c61f55eb.json'
at webpackEmptyContext (node_modules_taro_weapp_prebundle_sync_recursive-_94895.js? [sm]:10)
at node_modulesMomentTimezoneIndexJs (vendors-node_modules_taro_weapp_prebundle_moment-timezone_js.js? [sm]:545)
at __require2 (node_modules_taro_weapp_prebundle_mitt_js.js? [sm]:32)
at entryMomentTimezone (vendors-node_modules_taro_weapp_prebundle_moment-timezone_js.js? [sm]:551)
at __require2 (node_modules_taro_weapp_prebundle_mitt_js.js? [sm]:32)
at Module.node_modulesTaroWeappPrebundleMomentTimezoneCoreJs (vendors-node_modules_taro_weapp_prebundle_moment-timezone_js.js? [sm]:554)
at webpack_require (webpack_bootstrap:19)
at Object.node_modulesTaroWeappPrebundleMomentTimezoneJs (vendors-node_modules_taro_weapp_prebundle_moment-timezone_js.js? [sm]:573)
at webpack_require (webpack_bootstrap:19)
at remoteEntry.js? [sm]:87(env: macOS,mp,1.06.2401020; lib: 3.3.4)

环境信息

👽 Taro v3.6.30

process.env.TARO_ENV undefined
process.env.NODE_ENV undefined

  Taro CLI 3.6.30 environment info:
    System:
      OS: macOS 14.2.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.20.2 - /opt/homebrew/opt/nvm/versions/node/v18.20.2/bin/node
      Yarn: 1.22.21 - /opt/homebrew/bin/yarn
      npm: 10.5.0 - /opt/homebrew/opt/nvm/versions/node/v18.20.2/bin/npm
    npmPackages:
      @tarojs/cli: ^3.6.30 => 3.6.30 
      @tarojs/components: 3.6.28 => 3.6.28 
      @tarojs/components-react: ^3.6.31 => 3.6.31 
      @tarojs/helper: 3.6.32 => 3.6.32 
      @tarojs/plugin-framework-react: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-alipay: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-h5: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-jd: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-qq: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-swan: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-tt: 3.6.28 => 3.6.28 
      @tarojs/plugin-platform-weapp: 3.6.28 => 3.6.28 
      @tarojs/react: 3.6.28 => 3.6.28 
      @tarojs/runtime: 3.6.28 => 3.6.28 
      @tarojs/shared: 3.6.28 => 3.6.28 
      @tarojs/taro: 3.6.28 => 3.6.28 
      @tarojs/taro-loader: 3.6.28 => 3.6.28 
      @tarojs/webpack5-runner: 3.6.28 => 3.6.28 
      babel-preset-taro: 3.6.28 => 3.6.28 
      eslint-config-taro: 3.6.28 => 3.6.28 
      react: ^18.0.0 => 18.3.1 



补充信息

当使用了moment-timezone时

This was referenced Jun 22, 2024
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

1 participant