-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Use native ESM #101
Comments
試しに ESM 化された
|
ts-jest が未対応なので以下の設定を試すもエラーは直らず。 tsconfig.json
{
"exclude": ["tests", "lib"],
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowJs": true
}
} jest.config.js
module.exports = {
globals: {
'ts-jest': {
useESM: true,
},
},
preset: 'ts-jest/presets/js-with-ts-esm',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
testPathIgnorePatterns: ['lib'],
}; |
簡単な設定変更で対応可能なら 1.0、難しければ 2.0 へ見送る。現時点では 2.0 としておく。 |
現状のわかりやすいまとめ。簡単な設定変更では対応できなさそうだ。 |
remark v13 以降へ対応するための micromark 調査用に作成したプロジェクトで ts-jest による Native ESM を試してみた。 Jest v27 系なら以下の設定でゆける。
1 は {
"scripts": {
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
}
} 2 は Jest 設定が module.exports = {
transform: {
'^.+\\.ts$': 'ts-jest'
},
preset: 'ts-jest/presets/js-with-ts-esm',
globals: {
'ts-jest': {
useESM: true
}
}
} この方法では TypeScript から ESM な JS を |
Given that Node.js 12 has become a MAINTENANCE LTS, some npm that VFM depends on is also native ESM. VFM will eventually have to support these.
The text was updated successfully, but these errors were encountered: