Skip to content

Commit 610c50b

Browse files
authored
Update Babel config to target modern browsers/Node.js (#1262)
1 parent 964d84b commit 610c50b

File tree

12 files changed

+586
-281
lines changed

12 files changed

+586
-281
lines changed

.changeset/brown-timers-hang.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@vanilla-extract/babel-plugin-debug-ids': patch
3+
'@vanilla-extract/esbuild-plugin-next': patch
4+
'@vanilla-extract/esbuild-plugin': patch
5+
'@vanilla-extract/integration': patch
6+
'@vanilla-extract/jest-transform': patch
7+
'@vanilla-extract/next-plugin': patch
8+
'@vanilla-extract/parcel-transformer': patch
9+
'@vanilla-extract/rollup-plugin': patch
10+
'@vanilla-extract/vite-plugin': patch
11+
'@vanilla-extract/webpack-plugin': patch
12+
---
13+
14+
Update Babel config to target Node.js 14

.changeset/spotty-suits-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/integration': patch
3+
---
4+
5+
Upgrade Vite and vite-node

.changeset/tricky-games-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/vite-plugin': patch
3+
---
4+
5+
Lazy load Vite to avoid the CJS warning

babel.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
module.exports = {
22
presets: [
3-
['@babel/preset-env', { targets: { node: 12 } }],
3+
['@babel/preset-env', { targets: { node: '14.21' } }],
44
'@babel/preset-typescript',
5-
'@babel/preset-react',
65
],
7-
86
overrides: [
97
{
108
include: [

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@changesets/cli": "^2.26.2",
3434
"@manypkg/cli": "^0.19.1",
3535
"@playwright/test": "^1.40.1",
36-
"@preconstruct/cli": "^2.0.1",
36+
"@preconstruct/cli": "^2.8.2",
3737
"@swc/core": "^1.2.112",
3838
"@testing-library/jest-dom": "^5.11.9",
3939
"@types/jest": "^29.2.5",
@@ -50,9 +50,12 @@
5050
"rollup-plugin-node-externals": "^5.0.0",
5151
"ts-node": "^10.0.0",
5252
"typescript": "^4.9.4",
53-
"vitest": "^0.28.5"
53+
"vitest": "^1.1.0"
5454
},
5555
"preconstruct": {
56+
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
57+
"keepDynamicImportAsDynamicImportInCommonJS": true
58+
},
5659
"packages": [
5760
"packages/*"
5861
]

packages/integration/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"lodash": "^4.17.21",
2626
"mlly": "^1.1.0",
2727
"outdent": "^0.8.0",
28-
"vite": "^4.1.4",
29-
"vite-node": "^0.28.5"
28+
"vite": "^5.0.10",
29+
"vite-node": "^1.1.0"
3030
},
3131
"devDependencies": {
3232
"@types/babel__core": "^7.1.20",

packages/vite-plugin/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import path from 'path';
22

33
import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite';
4-
import { normalizePath } from 'vite';
54
import outdent from 'outdent';
65
import {
76
cssFileFilter,
@@ -33,6 +32,8 @@ export function vanillaExtractPlugin({
3332
let config: ResolvedConfig;
3433
let server: ViteDevServer;
3534
let postCssConfig: PostCSSConfigResult | null;
35+
// We lazily load this utility from Vite
36+
let normalizePath: (fsPath: string) => string;
3637
const cssMap = new Map<string, string>();
3738

3839
const hasEmitCssOverride = typeof emitCssInSsr === 'boolean';
@@ -68,6 +69,7 @@ export function vanillaExtractPlugin({
6869
async configResolved(resolvedConfig) {
6970
config = resolvedConfig;
7071
packageName = getPackageInfo(config.root).name;
72+
normalizePath = (await import('vite')).normalizePath;
7173

7274
if (config.command === 'serve') {
7375
postCssConfig = await resolvePostcssConfig(config);

0 commit comments

Comments
 (0)