Comments (9)
这个 gist 进行了一个很好的解释,但是我仍然需要更多地知识,最好一个现成的修改示例。
from adachi-bot.
找到一个自动转换 https://github.com/tbranyen/babel-plugin-transform-commonjs
from adachi-bot.
当前我借助 babel 实现了自动转换,但是遇到了一个大问题,ESM 不支持动态模块导入,import 后面必须跟字符串,这个问题怎么解决? @SilveryStar 老大哥知道怎么搞么?
Lines 23 to 33 in e62e4f5
Lines 60 to 70 in e62e4f5
还有个问题就是 js-beautify 为啥老是把注释给上一个语句块?
if (a) {
}
// 关于 b 的注释
if (b) {
}
->
if (a) {
} // 关于 b 的注释
if (b) {
}
from adachi-bot.
我觉得还是不要瞎比搞了,能跑就行,这堆概念看得我都大
from adachi-bot.
找了个工具,不用改代码 https://www.npmjs.com/package/esm
from adachi-bot.
我花了一整天终于知道要怎么做了,得删掉分支重做一下,现在的提交太占空间了。
from adachi-bot.
TypeScript
是JavaScript
的语法超集,主要还是用来补足JavaScript
的不足和OOP
支持- 事实上
TypeScript
版的新项目在导入插件的时候还是使用的CJS
方式,见TS文档,在Node.js
中使用ESM
动态导入,需要import()
关键词,见 MDN - 关于 「JS 标准的约定或者习俗」,我是纯野路子,不懂,自己凭感觉写的(
js-beautify
没用过- 如果想换
TypeScript
,不妨来给 v2.x 做插件(?
from adachi-bot.
@SilveryStar 感谢老大哥,一天天的净面向网友编程了
from adachi-bot.
摸鱼两天才搞完,这玩意儿居然是没意义的,太强了
from adachi-bot.
Related Issues (20)
- 版本3.7 HOT 15
- ver3.8 HOT 5
- 角色、武器信息的材料加个名字 HOT 3
- 3.2 版本 HOT 17
- 米游社接口报错: character id:10000070 is not exists HOT 2
- win启动报错 HOT 5
- 3.3 版本 HOT 10
- JS module CI failed HOT 2
- 解决 oicq 版本过低的问题 HOT 21
- 米游社域名换了 HOT 6
- 发不出群消息了 HOT 3
- 管理员指令没有效果 HOT 15
- 新法器名字 overflow
- 项目前端工程化 HOT 10
- 3.4 版本 HOT 4
- 米游社卡片草神瞳不用v-if了
- ver3.5 HOT 8
- 海哥裂了? HOT 10
- 扫码登陆失败 HOT 18
- new ver HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adachi-bot.