-
Notifications
You must be signed in to change notification settings - Fork 3k
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
import npm 模块 报错 #342
Comments
这是两个错误?没太看懂你的描述 第一个好像是没有编译的问题,dist里的代码不可能有import |
两个问题之间的区别在于,第一个npm包是开源的fecha,第二个是我自己构建的npm包 |
编译完后都不会有 import关键字的。。怎么会报 |
第二个问题的可能原因
|
@Gcaufy 第二个问题,能否重现? |
看了下源码,确实只支持但文件引入
@Gcaufy 给我一个回复?这个问题你们后续会解决吗?还是。。。 |
依然不太明白问题, |
貌似跟我的引用私有 npm 包一样 问题出现在以下两个地方: 我的调整::/import\s*([\w-_])\sfrom\s*['"]([\w-_./\ @]*)['"]/ig; 2、在 util.js 中 findComponent 方法中 124 行使用了 com.indexOf(path.sep) !== -1 进行判断是否是 node_modules 中的模块,忽略了 私有库中带有"@"符号这种情况,导致找不到这个组件; 我的调整:添加 com.indexOf('@') === -1 判断条件来命中带"@"符号这种情况; 我这是找原文件中的位置,你可要找编译后的位置调整下就OK |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
引用npm模块fecha报错
index.js:1 Uncaught SyntaxError: Unexpected token export factory.js:1 Uncaught SyntaxError: Unexpected token import
import fecha from 'fecha'
引用自己定义的npm模块报错
WAService.js:9 Uncaught Error: module "npm/@xhs/http/index.js" is not definedrequire @ WAService.js:9(anonymous function) @ WAService.js:9(anonymous function) @ app.js [sm]:5require @ WAService.js:9(anonymous function) @ app.js:130 base.js:137 Uncaught TypeError: Cannot read property '$pages' of undefined
import http from '@xhs/http'
在线等待回复
The text was updated successfully, but these errors were encountered: