project: Move to ESM Modules
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto;
|
||||
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
|
||||
yarn pbjs -t static-module -w es6 --no-bundle -o ./WAProto/index.js ./WAProto/WAProto.proto;
|
||||
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
|
||||
node ./fix-imports.js
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { argv, exit } from 'process';
|
||||
|
||||
const filePath = './index.js';
|
||||
|
||||
try {
|
||||
// Read the file
|
||||
let content = readFileSync(filePath, 'utf8');
|
||||
|
||||
// Fix the import statement
|
||||
content = content.replace(
|
||||
/import \* as (\$protobuf) from/g,
|
||||
'import $1 from'
|
||||
);
|
||||
|
||||
// Write back
|
||||
writeFileSync(filePath, content, 'utf8');
|
||||
|
||||
console.log(`✅ Fixed imports in ${filePath}`);
|
||||
} catch (error) {
|
||||
console.error(`❌ Error fixing imports: ${error.message}`);
|
||||
exit(1);
|
||||
}
|
||||
+4136
-4138
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user