-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts-pegjs
does not work when using type: 'module'
in package.json
#114
Comments
I also confirm this |
I'm also seeing this. Is there a workaround? |
I fixed it by creating a |
Sure, but my build scripts was written in TypeScript and some of the modules won't even work in CommonJS mode. It's easier to just not upgrade yet. |
You can force TypeScript into CommonJS mode using |
This is the solution I came up with: https://github.com/KrofDrakula/mathpls Note the |
My hacky workaround for this was to change the following in from
to
|
Any update on this issue? Its been a year and it seems only hacks are an option |
Reproduction
Using version 3.x of
peggy
and 4.2.x ofts-pegjs
.Set the project type to
"module"
inpackage.json
. Importpeggy
andts-pegjs
as usual:A live reproduction is available on StackBlitz:
https://stackblitz.com/edit/vitejs-vite-asiiyk?file=scripts%2Fbuild.js&terminal=dev
Use command
npm run peggy
to run the script.Expected result
Running this script should log out the generated parser source.
Actual result
Error
[ERR_MODULE_NOT_FOUND]: Cannot find module '/home/projects/vitejs-vite-asiiyk/node_modules/prettier/parser-typescript' imported from /home/projects/vitejs-vite-asiiyk/node_modules/ts-pegjs/dist/tspegjs.mjs
is generated.Error log:
The text was updated successfully, but these errors were encountered: