易语言使用node编译的js文件

环境配置

npm install -g cnpm  babel-preset-env  babel-cli babel-polyfill browserify
npm install -g crypto-js 

nodejs转js

例如加密模块

browserify -r babel-polyfill -r crypto-js  -o  es6.txt
browserify file.js -o es6.txt

易语言

使用v8 推荐

直接生成导入js即可, 带 -s Crypto 参数
在这里插入图片描述

.版本 2
.支持库 spec

.局部变量 js, 类_脚本组件
.局部变量 ret, 文本型

' 本名称子程序用作测试程序用,仅在开发及调试环境中有效,编译发布程序前将被系统自动清空,请将所有用作测试的临时代码放在本子程序中。 ***注意不要修改本子程序的名称、参数及返回值类型。
V8.InitializeV8 ()
ret = V8.ExecJavaScriptV8 (#常量js, “Crypto.MD5(123)”)
调试输出 (“v8:” + ret)

不带 -s Crypto

ret = V8.ExecJavaScriptV8 (#常量js + “var Crypto = require(” + #引号 + “crypto-js” + #引号 + “);”, “Crypto.MD5(123)”)

生成类_脚本组件能使用的js

自带的是jscript,且仅支持js5语法,需要转换,不然报错
微软 jscript支持ECMA-262即ECMAScript5.1

ES6转es5

需要补环境,不复杂就用这种方式吧

babel --no-babelrc --presets=env es6.txt -o es5.txt

https://github.com/inexorabletash/polyfill/blob/master/polyfill.js

命令

browserify详解

Usage: browserify [entry files] {OPTIONS}

Standard Options:

    --outfile, -o  Write the browserify bundle to this file.
                   If unspecified, browserify prints to stdout.

    --require, -r  A module name or file to bundle.require()
                   Optionally use a colon separator to set the target.

  --standalone -s  Generate a UMD bundle for the supplied export name.
                   This bundle works with other module systems and sets the name
                   given as a window global if no module system is found.

问题记录

node环境配置

prefix=I:\nodejs\node_global
cache=I:\nodejs\node_cache

需要设置NODE_PATH 路径为 I:\nodejs\node_global\node_modules

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

骇客之技术

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值