Skip to content

Commit

Permalink
fix(gen): isolate generator to commonjs (vercel#8109)
Browse files Browse the repository at this point in the history
### Description

As described by vercel#5657, the default `simple-*` templates creates a
template that is broken for `"type": "module"` packages.

When digging into this issue I found out that a simple `package.json`
with `"type": "commonjs"` solves the problems by telling the runtime to
treat the file diferently from the parent package.

### Testing Instructions

- Initialize a new monorepo with `"type": "module"` in the
`package.json`
- on this branch it should now be possible to generate the sample
generator (either `js` or `ts`) and not have any errors about the module
type.
- it should also be possible to run the generator and it should create
the file in the project root normally.
resolves vercel#5657
  • Loading branch information
wesleycoder authored and Neosoulink committed Jun 14, 2024
1 parent 24ac241 commit bd970be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/turbo-gen/src/templates/simple-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
3 changes: 3 additions & 0 deletions packages/turbo-gen/src/templates/simple-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}

0 comments on commit bd970be

Please sign in to comment.