-
Notifications
You must be signed in to change notification settings - Fork 346
chore: ESModuleにする #2580
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
chore: ESModuleにする #2580
Conversation
d66dfff to
12b865a
Compare
|
🚀 プレビュー用ページを作成しました 🚀 更新時点でのコミットハッシュ: |
Hiroshiba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ts書かないといけないの悲しいですね。。。
と思ったけどvoicevox_blogの方は書いてないんですよね。
ちょっと調べた感じ、moduleResolutionを設定してあげるとこういうこともなさそう・・・?
https://speakerdeck.com/uhyo/tsconfig-dot-jsonnoshe-ding-wojian-zhi-sou-hurontoendoxiang-ke-2024xia?slide=32
正直書いてない方が気持ち悪い気持ちがあります(個人の気持ち) |
|
結構書かない派が多そう? vite 実益もあって、 |
それはどちらもCommonJS(昔のNode式)を使っているからだと思います |
CommonJSだと 実利もあるので!(二度目) |
|
いろいろ調べた感じ、少なくとも今はまだ拡張子を書かないのが主流な気がしました。 tsconfigのbaseを考えてるコミュニティ的には、moduleResolutionにbundler指定したらええんちゃうって雰囲気でした。 vueのtsconfig.jsonも↑だった。まあこれはesmではないですが。 あと半年とか1年経ってくると変わってくるかもだけど、少なくとも今じゃなさそうな直感。 |
|
とりあえず戻しました。 Detailslog = File.read("./__gi_log.log")
current_file = ""
file_lines = []
[*log.lines, "/dev/null"].each do |line|
if line.start_with?("/")
File.write(current_file, file_lines.join) unless file_lines.empty?
current_file = line.strip
file_lines = File.read(current_file).lines
elsif line.include?("import/extensions")
line, column = line.match(/ (\d+):(\d+)/).captures
column = column.to_i - 1
quoted = file_lines[line.to_i - 1][column..].match(/^"(.+?)"/)
content = quoted.captures.first
file =
if content.start_with?("@")
"#{__dir__}/src/#{content[2..]}.ts"
else
"#{File.dirname(current_file)}/#{content}.ts"
end
if File.exist?(file)
file_lines[line.to_i - 1] = file_lines[line.to_i - 1].gsub(
content,
"#{content}.ts"
)
elsif File.exist?(file.gsub(/\.ts$/, "/index.ts"))
file_lines[line.to_i - 1] = file_lines[line.to_i - 1].gsub(
content,
"#{content}/index.ts"
)
else
warn "File not found: #{file}"
end
end
end |
Hiroshiba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良い感じ!!!
electron-builder周りもいつかtsにできると嬉しいなぁ。
eca5ab7 to
57f9ca0
Compare
Hiroshiba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
シンプル!!!
内容
Voicevox全体をESModuleに移行します。
electron-builder周りはまだ辛そうだったのでcjsのままです。
関連 Issue
(なし)
スクリーンショット・動画など
(なし)
その他
#2581 が先。