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

Build to ESM: auto add .js extension #103

Closed
mantou132 opened this issue Dec 12, 2023 · 4 comments
Closed

Build to ESM: auto add .js extension #103

mantou132 opened this issue Dec 12, 2023 · 4 comments
Labels
enhancement New feature or request plugin

Comments

@mantou132
Copy link
Owner

mantou132 commented Dec 12, 2023

一个调用 tsc 的脚本 // swc

让构建产物直接支持浏览器 module 加载

type: "module"

  • 手动添加 .js 扩展名
  • ts 自定义 transform
  • 脚本替换
@mantou132 mantou132 added the enhancement New feature or request label Dec 12, 2023
@mantou132
Copy link
Owner Author

不从裸模块导入:

import { html, render } from 'lit-html/xxx.js';
import { GemElement, html } from '@mantou/gem/lib/element.js';
import './use.js';

export { guard } from 'lit-html/directives/guard.js';

浏览器使用:

{
  "imports": {
    "lit-html/": "xxxxx/",
    "@mantou/gem/": "xxxx/"
  }
}

@mantou132
Copy link
Owner Author

WICG/import-maps#7

@mantou132
Copy link
Owner Author

mantou132 commented Sep 2, 2024

create tool t2e(TypeScript to EcmaScript):

  • resolve full path: import './a' -> import './a/index.js'
  • dep resolve: import 'a' -> import 'https://esm.sh/a'

https://github.com/justkey007/tsc-alias No integrated tsc

@mantou132 mantou132 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2024
@mantou132
Copy link
Owner Author

5.7 microsoft/TypeScript#59767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin
Projects
None yet
Development

No branches or pull requests

1 participant