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

压缩失败;编译错误;works_threads #2316

Closed
glazec opened this issue Mar 2, 2019 · 3 comments
Closed

压缩失败;编译错误;works_threads #2316

glazec opened this issue Mar 2, 2019 · 3 comments

Comments

@glazec
Copy link

glazec commented Mar 2, 2019

问题描述
1.文件压缩失败
2.编译时出现错误
3.works_threads一直显示正在下载

复现步骤
[复现问题的步骤]

firebase.js
export default function firebaseInit(){
const admin = require('firebase-admin');

var serviceAccount = require('../../config/total-array-182700-7d14cdcbbf54.json');

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount)
});

var db = admin.firestore();
return db
}
ticketHelpe.js
export default function readTicket(db){
    // const admin = require('firebase-admin');
    db.collection('tickets').get()
    .then((snapshot) => {
      snapshot.forEach((doc) => {
        console.log(doc.departure);
      });
    })
    .catch((err) => {
      console.log('Error getting documents', err);
    });
}

安装firebase-admin

期望行为
修复bug

报错信息
压缩错误报错范例(由于报错太多四千行,剩余的在附件里)

错误  压缩错误  文件C:\Users\***\Documents\Program\NASF\node_modules\firebase-admin\node_modules\node-forge\lib\ed25519.js
{ SyntaxError: Unexpected token: keyword (const)
    at JS_Parse_Error.get (eval at <anonymous> (C:\Users\***\Documents\Program\NASF\node_modules\uglify-js\tools\node.js:20:1), <anonymous>:71:23)
    at formatError (internal/util/inspect.js:817:16)
    at formatRaw (internal/util/inspect.js:616:14)
    at formatValue (internal/util/inspect.js:511:10)
    at inspect (internal/util/inspect.js:191:10)
    at Object.formatWithOptions (util.js:84:12)
    at Console.(anonymous function) (console.js:191:15)
    at Console.log (console.js:202:31)
    at recursiveRequire (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\src\util\resolve_npm_files.js:210:19)
    at CallExpression (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\src\util\resolve_npm_files.js:135:21)
  message: 'Unexpected token: keyword (const)',
  filename: '0',
  line: 188,
  col: 2,
  pos: 6953 }

编译报错 剩余的在附件里

错误  编译失败  src\service\firebase.js
TypeError: Property properties expected type of array but got object
    at validate (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-types\lib\definitions\index.js:161:13)
    at Object.validate (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-types\lib\definitions\index.js:190:10)
    at validate (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-types\lib\index.js:505:9)
    at Object.builder (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-types\lib\index.js:466:7)
    at CallExpression (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\src\weapp.js:689:45)
    at NodePath._call (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-traverse\lib\path\context.js:76:18)
    at NodePath.call (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-traverse\lib\path\context.js:48:17)
    at NodePath.visit (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-traverse\lib\path\context.js:105:12)
    at TraversalContext.visitQueue (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-traverse\lib\context.js:150:16)
    at TraversalContext.visitSingle (C:\Users\***\AppData\Roaming\nvm\v10.15.1\node_modules\@tarojs\cli\node_modules\babel-traverse\lib\context.js:108:19)

系统信息
� Taro v1.2.15

Taro CLI 1.2.15 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.15.1 - C:\Program Files\nodejs\node.EXE
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
平台:微信小程序

补充信息
wors_threads 为node的特性,因该不会存在没有安装的情况。
编译错误.txt
压缩错误.txt

@taro-bot
Copy link

taro-bot bot commented Mar 2, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@umaim
Copy link
Contributor

umaim commented Apr 1, 2019

mishoo/UglifyJS#3275
webpack-contrib/uglifyjs-webpack-plugin#362
https://stackoverflow.com/questions/47439067/uglifyjs-throws-unexpected-token-keyword-const-with-node-modules

UglifyJS 压缩的问题,似乎是它不支持压缩 ES6,const 是 ES6 关键字

我的解决办法是,把控制台日志里涉及的第三方包用 babel 先编译成 ES5,然后再 build (:з)∠)

@WangShuXian6
Copy link

mishoo/UglifyJS2#3275
webpack-contrib/uglifyjs-webpack-plugin#362
https://stackoverflow.com/questions/47439067/uglifyjs-throws-unexpected-token-keyword-const-with-node-modules

UglifyJS 压缩的问题,似乎是它不支持压缩 ES6,const 是 ES6 关键字

我的解决办法是,把控制台日志里涉及的第三方包用 babel 先编译成 ES5,然后再 build (:з)∠)

我的页面都是函数式的

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