Skip to content

Commit f01cbf4

Browse files
committed
Convert mangleErrors.mts to ESM
1 parent b62f25b commit f01cbf4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/toolkit/scripts/mangleErrors.mts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs')
2-
const path = require('path')
3-
const helperModuleImports = require('@babel/helper-module-imports')
2+
import * as helperModuleImports from '@babel/helper-module-imports'
3+
import * as fs from 'node:fs'
44

55
/**
66
* Converts an AST type into a javascript string so that it can be added to the error message lookup.
@@ -55,7 +55,7 @@ const evalToString = (ast) => {
5555
* throw new Error(node.process.NODE_ENV === 'production' ? 0 : "This is my error message.");
5656
* throw new Error(node.process.NODE_ENV === 'production' ? 1 : "This is a second error message.");
5757
*/
58-
module.exports = (babel) => {
58+
export const mangleErrorsPlugin = (babel) => {
5959
const t = babel.types
6060
// When the plugin starts up, we'll load in the existing file. This allows us to continually add to it so that the
6161
// indexes do not change between builds.
@@ -157,3 +157,5 @@ module.exports = (babel) => {
157157
},
158158
}
159159
}
160+
161+
export default mangleErrorsPlugin

0 commit comments

Comments
 (0)