Skip to content

Commit b10b431

Browse files
Transpile import.meta.url in config files (#13322)
* Use Babel to transpile configs when import.meta is present * Update minimum jiti version * Update changelog
1 parent 44b3b42 commit b10b431

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Add `mix-blend-plus-darker` utility ([#12923](https://github.com/tailwindlabs/tailwindcss/pull/12923))
1717
- Ensure dashes are allowed in variant modifiers ([#13303](https://github.com/tailwindlabs/tailwindcss/pull/13303))
1818
- Fix crash showing completions in Intellisense when using a custom separator ([#13306](https://github.com/tailwindlabs/tailwindcss/pull/13306))
19+
- Transpile `import.meta.url` in config files ([#13322](https://github.com/tailwindlabs/tailwindcss/pull/13322))
1920

2021
## [3.4.1] - 2024-01-05
2122

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"fast-glob": "^3.3.0",
7373
"glob-parent": "^6.0.2",
7474
"is-glob": "^4.0.3",
75-
"jiti": "^1.19.1",
75+
"jiti": "^1.21.0",
7676
"lilconfig": "^2.1.0",
7777
"micromatch": "^4.0.5",
7878
"normalize-path": "^3.0.0",

src/lib/load-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ function lazyJiti() {
1818
(jiti = jitiFactory(__filename, {
1919
interopDefault: true,
2020
transform: (opts) => {
21+
// Sucrase can't transform import.meta so we have to use Babel
22+
if (opts.source.includes('import.meta')) {
23+
return require('jiti/dist/babel.js')(opts)
24+
}
25+
2126
return transform(opts.source, {
2227
transforms: ['typescript', 'imports'],
2328
})

standalone-cli/standalone.js

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ useCustomJiti(() =>
3333
interopDefault: true,
3434
nativeModules: Object.keys(localModules),
3535
transform: (opts) => {
36+
// Sucrase can't transform import.meta so we have to use Babel
37+
if (opts.source.includes('import.meta')) {
38+
return require('jiti/dist/babel.js')(opts)
39+
}
40+
3641
return transform(opts.source, {
3742
transforms: ['typescript', 'imports'],
3843
})

0 commit comments

Comments
 (0)