Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1cdde66

Browse files
[更改] 让 Babel 转换 import.meta.url 的插件只在单元测试的环境生效
1 parent 02f961e commit 1cdde66

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎babel.config.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
const test = process.env.NODE_ENV === 'test'
2+
13
module.exports = {
24
presets: [
35
['@babel/preset-env', { targets: { node: 'current' } }],
46
'@babel/preset-typescript'
57
],
68
plugins: [
7-
'babel-plugin-transform-import-meta'
9+
...(test ? ['babel-plugin-transform-import-meta'] : [])
810
]
911
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /