Replies: 5 comments 1 reply
-
have you tested:
to be very honest we never tested this options settings, if you can, open a pull request creating a extra package reproducing your case, so we can work on it |
Beta Was this translation helpful? Give feedback.
-
@s5b can you check if this would solve your issue? |
Beta Was this translation helpful? Give feedback.
-
@ggazzo Thank you for replying; very, very much appreciated. I tried something similar to your example above, but without success. I tried the syntax: I'll have another go with the alternative that you're demonstrating above. And thanks for the reference to #1368, too. That will be helpful. |
Beta Was this translation helpful? Give feedback.
-
NOTE: I've solved this @ggazzo I'm having trouble configuring Rather than install npm install --save-dev peggy
npm install --save-dev @rocket.chat/peggy-loader Following your recommendation, I changed my
This configuration gave me the error that
And this gives me the error There doesn't appear to be a top-level entry for Can you please tell me what I'm doing wrong here? (Edit: My bad!) |
Beta Was this translation helpful? Give feedback.
-
@ggazzo The problem above was created by my own typographical error. I used Please ignore my most recent message. |
Beta Was this translation helpful? Give feedback.
-
I have a
peggy.js
grammar that has a dependency on big.js for managing numeric arithmetic and comparisons as part of the implementation. I'm currently passing theBig
function through the runtimeoptions
parameter to the generated parser, but this is annoying and requires a lot of options setup code (noise) every time I want to use the parser in my production code.I want to generate a self-contained parser that has the dependency built in.
I see that there is a
--dependency
CLI attribute to have the parser require a specified dependency. And if I understand this correctly, this would generate a parser that is more stand-alone than the runtime options configuration that I'm now using.My problem is that I don't know how to configure this dependency management as part of my
webpack
build. In thewebpack.config.js
file I have the following configuration:I'm hoping that I can add the dependencies reference to the end of the
loader
definition. But I'm not sure of the syntax. I expect it to be something like:{test: /\.peggy$/i, loader: 'peggy-loader?dependency=Big:big.js'}
And then just reference the dependency in the grammar as, for example,
const bigTwentyThree = Big('23');
However, my expectation attempt for the
webpack
configuration above doesn't work.Can somebody provide me with some guidance on how to use the loader to include my dependency, please?
Thanks for reading.
Beta Was this translation helpful? Give feedback.
All reactions