A webpack loader for Lezer grammar files (.grammar). Currently at version 0.3.0 with a stable API. It enables importing .grammar files as parser modules, supporting external token imports. No configuration options are supported yet. @external imports in grammar files are not tracked as webpack dependencies, requiring manual rebuild triggers. Best paired with @lezer/generator and @lezer/lr for TypeScript usage.
npm install lezer-loaderVerified import paths — ran on the pinned version, not inferred.
Configures webpack to handle .grammar files with lezer-loader, enabling import of Lezer parsers.
Manually edit the .grammar file (e.g., add a comment or change whitespace) to force webpack to recompile.
Do not pass any options to the loader in webpack config.
Add rule { test: /\.grammar$/, use: 'lezer-loader' } to webpack config.Ensure the @external tokens import path in the grammar file is correct and the module is accessible.