diff --git a/packages/unplugin-typegpu/src/babel.ts b/packages/unplugin-typegpu/src/babel.ts index f1e6fe1be3..0b1b532c8e 100644 --- a/packages/unplugin-typegpu/src/babel.ts +++ b/packages/unplugin-typegpu/src/babel.ts @@ -2,7 +2,7 @@ import type { NodePath, TraverseOptions } from '@babel/traverse'; import defu from 'defu'; import { transpileFn } from 'tinyest-for-wgsl'; import { FORMAT_VERSION } from 'tinyest'; -import { t } from './core/babel-types.ts'; +import * as t from '@babel/types'; import { type PluginState, defaultOptions, diff --git a/packages/unplugin-typegpu/src/core/babel-types.ts b/packages/unplugin-typegpu/src/core/babel-types.ts deleted file mode 100644 index c9052431d5..0000000000 --- a/packages/unplugin-typegpu/src/core/babel-types.ts +++ /dev/null @@ -1,5 +0,0 @@ -// oxlint-disable-next-line import/no-unassigned-import -- imported for side effects -import './polyfill-process.ts'; - -import * as t from '@babel/types'; -export { t }; diff --git a/packages/unplugin-typegpu/src/core/common.ts b/packages/unplugin-typegpu/src/core/common.ts index 5bd278cfca..c2e8574998 100644 --- a/packages/unplugin-typegpu/src/core/common.ts +++ b/packages/unplugin-typegpu/src/core/common.ts @@ -1,4 +1,4 @@ -import { t } from './babel-types.ts'; +import * as t from '@babel/types'; import type { NodePath, TraverseOptions } from '@babel/traverse'; import type { FilterPattern } from 'unplugin'; import { MagicStringAST } from 'magic-string-ast'; diff --git a/packages/unplugin-typegpu/src/core/factory.ts b/packages/unplugin-typegpu/src/core/factory.ts index e2d73f9f19..57e6ca66ba 100644 --- a/packages/unplugin-typegpu/src/core/factory.ts +++ b/packages/unplugin-typegpu/src/core/factory.ts @@ -6,7 +6,7 @@ import _traverse, { type NodePath } from '@babel/traverse'; import { FORMAT_VERSION } from 'tinyest'; import { transpileFn } from 'tinyest-for-wgsl'; import * as parser from '@babel/parser'; -import { t } from './babel-types.ts'; +import * as t from '@babel/types'; import { defaultOptions, earlyPruneRegex, diff --git a/packages/unplugin-typegpu/src/core/polyfill-process.ts b/packages/unplugin-typegpu/src/core/polyfill-process.ts deleted file mode 100644 index 014eef0cad..0000000000 --- a/packages/unplugin-typegpu/src/core/polyfill-process.ts +++ /dev/null @@ -1,8 +0,0 @@ -// The babel plugin can be imported in a browser, which doesn't have `process` defined -if (typeof globalThis.process === 'undefined') { - // oxlint-disable-next-line typescript/no-explicit-any - (globalThis.process as any) = {}; -} -if (typeof globalThis.process.env === 'undefined') { - globalThis.process.env = {}; -} diff --git a/packages/unplugin-typegpu/tsdown.config.ts b/packages/unplugin-typegpu/tsdown.config.ts index bb36a60dde..f07b295a28 100644 --- a/packages/unplugin-typegpu/tsdown.config.ts +++ b/packages/unplugin-typegpu/tsdown.config.ts @@ -9,6 +9,7 @@ export default defineConfig({ 'src/esbuild.ts', 'src/farm.ts', 'src/rolldown.ts', + 'src/rolldown-browser.ts', 'src/rspack.ts', 'src/vite.ts', 'src/webpack.ts',