Closed goyaltushar92 closed 4 years ago
That's a pretty odd problem. "fs" is a standard Node.js module, how can it fail to load?
fs is not available for browsers... it is file system specific library as file system is not available on browser, so, this library too isn't available.
I readed some where InterpreterDataReader.js
is used for tests.
is it realy needed to be loaded...
Now I understand. Well, this is a tricky situation. The interpreter data reader is used to load interpreter data (which is not used by the c3 engine, but is part of the ANTLR4 Java runtime (and C++ and TS...)). However, TS and JS runtimes are a bit special, as you can use them in a browser environment and that's the tricky part: how to avoid importing the data read in such a case?
However, that is not a problem of antlr4-c3 but of antlr4ts. Can you open a new issue there?
I checked your code, I found 1 possible issue, in CodeCompletionCore.ts
we have import { IntervalSet } from 'antlr4ts/misc';
i also checked antr4ts
repo 'antlr4ts/misc'
loads InterpreterDataReader
too.
so, replacing import { IntervalSet } from 'antlr4ts/misc';
with import { IntervalSet } from 'antlr4ts/misc/IntervalSet';
should work.
i have created a pull request for the same
Interesting solution. Does it resolve the fs issue now?
Yes, that fixed my issue... I think you can push a release
In 1 of my projects our team was previously using antlr4-c3 with angular 6 but, after version update it doesn't seems to work. it says
ERROR in ./node_modules/antlr4ts/misc/InterpreterDataReader.js Module not found: Error: Can't resolve 'fs'
. i don't think it is problem withantlr4ts
, as in our POC project we were able to use antlr4ts without any issue. Please also suggest, if we can have a work arround, or we need to use older version of library.