Skip to content

Commit

Permalink
WIP attempt at making "type":"module" work
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Nov 11, 2023
1 parent 2032e16 commit 31975ff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function (api) {
export default function (api) {
api.cache(true);
return {
presets: ['@babel/preset-typescript'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@webgpu/cts",
"version": "0.1.0",
"description": "WebGPU Conformance Test Suite",
"type": "module",
"scripts": {
"test": "grunt all",
"all": "grunt all",
Expand Down
6 changes: 3 additions & 3 deletions src/common/runtime/helper/sys.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint no-process-exit: "off" */
/* eslint @typescript-eslint/no-namespace: "off" */

function node() {
const { existsSync } = require('fs');
async function node() {
const { existsSync } = await import('fs');

return {
type: 'node',
Expand Down Expand Up @@ -41,6 +41,6 @@ function deno() {
};
}

const sys = typeof globalThis.process !== 'undefined' ? node() : deno();
const sys = typeof globalThis.process !== 'undefined' ? await node() : deno();

export default sys;

0 comments on commit 31975ff

Please sign in to comment.