Add type: module to package.json

This commit is contained in:
Sidharth Vinod
2022-09-20 21:14:56 +05:30
parent 25ed9063f2
commit 827b3d47b7
3 changed files with 17 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
const { Generator } = require('jison');
const { transformJison } = require('./jisonTransformer.cjs');
const fs = require('fs');
const { dependencies } = require('../package.json');
@@ -93,9 +93,7 @@ const jisonPlugin = {
build.onLoad({ filter: /\.jison$/ }, async (args) => {
// Load the file from the file system
const source = await fs.promises.readFile(args.path, 'utf8');
const contents = new Generator(source, { 'token-stack': true }).generate({
moduleMain: '() => {}', // disable moduleMain (default one requires Node.JS modules)
});
const contents = transformJison(source);
return { contents, warnings: [] };
});
},