Comments (7)
Webpack 5
no longer polyfills Node.js core modules automatically, Add the following configuration to Webpack
(Reference details):
module.exports = {
//...
resolve: {
fallback: {
assert: require.resolve("assert"),
url: require.resolve("url"),
},
},
};
from antlr4ts.
你好,请问这个问题解决了么?我这边也碰到了相同的问题。
This is still a problem. The antlr4ts library depends on the process
and util
packages (only for debugging or profiling purposes). Since these packages are unavailable in the browser, they must be polyfilled. For those using vite, this package helps: https://www.npmjs.com/package/vite-plugin-node-polyfills
from antlr4ts.
from antlr4ts.
你好,请问这个问题解决了么?我这边也碰到了相同的问题。
from antlr4ts.
Been trying to get this to work with Angular 17. So I installed the package @irgijs suggested. But I do not understand how to get Angular 17 to understand this. Where should I at a reference to 'util' or 'process' package?
There is no webpack config file anymore in Angular 17....
Tried to add this to several files (like app.config.ts
and main.ts
.
(window as any).process = {
env: { DEBUG: undefined },
};
Any help is greatly appreciated. I finally got rid of a gazillion compiler errors when moving from Angular 13 to 17. And now during runtime this error shows up :(.
util.js:109 Uncaught ReferenceError: process is not defined
at node_modules/util/util.js (util.js:109:1)
at __require2 (chunk-723JPBGU.js?v=1f8d2492:46:50)
at node_modules/assert/build/internal/assert/assertion_error.js (assertion_error.js:25:16)
at __require2 (chunk-723JPBGU.js?v=1f8d2492:46:50)
at node_modules/assert/build/assert.js (assert.js:39:22)
at __require2 (chunk-723JPBGU.js?v=1f8d2492:46:50)
at node_modules/antlr4ts/misc/Array2DHashSet.js (Array2DHashSet.js:18:16)
at __require2 (chunk-723JPBGU.js?v=1f8d2492:46:50)
at node_modules/antlr4ts/misc/Array2DHashMap.js (Array2DHashMap.js:8:26)
at __require2 (chunk-723JPBGU.js?v=1f8d2492:46:50)
from antlr4ts.
Ok, answering my own question for those running into this problem.
What I didn´t have to do:
- install the above mentioned vite-polyfill
- install
browserify
I had to make the following changes
file: {projectroot}/tsconfig.app.json
- add "node" to the
compilerOptions->types
array
so this is my current file:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": [
"@angular/localize","node"
]
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}
- install the "@types/node" (for dev:
npm i --save-dev @types/node
)
Then make sure to restart your ng serve
in order to make sure the changes will be seen and used
Happy coding!
from antlr4ts.
@martinmolema eventually I switched to the "antlr4" package since it now natively supports typescript as a target.
from antlr4ts.
Related Issues (20)
- Can't run on an Angular project? HOT 2
- Inconsistent file generation across operating systems
- Example in the README uses a deprecated feature
- Generated Parser refers to C++ Classes (std::set<std::string>), unable to compile TS HOT 1
- Cannot find module ‘node_modules\antlr4ts\atn\ATN‘ HOT 1
- Please add support for Typescript 4.4.x HOT 11
- Update serialization version support
- Grammar r file `exception` rule is conflict with ParserRuleContext.exception
- antlr4ts cli's -o option is wrong affected by the grammar file option
- Incorporate the >4.10 release
- child process exited with code 3221226505
- return type declaration does not support function types
- Project continues to be updated? HOT 4
- Argument of type 'SqlParser' is not assignable to parameter of type 'Parser'.
- Could not generate files with esm type
- "cannot find tokens file" (documentation missing) HOT 1
- TS2339: Property 'compilationUnit' does not exist on type 'Python3Parser'. HOT 1
- Webpack 5 - AntlrTS in Browser HOT 3
- Suggestion for transformation of parse tree
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antlr4ts.