Skip to content

Commit

Permalink
Allow more ergonomic require of cjs esbuild plugin (#713)
Browse files Browse the repository at this point in the history
* Allow more ergonomic require of cjs esbuild plugin
  • Loading branch information
STRd6 authored Sep 8, 2023
1 parent 901b147 commit feef2ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/esbuild-plugin.civet
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,11 @@ defaultPlugin := civet()
// Default zero-config plugin
civet.setup = defaultPlugin.setup

// Hack to hybrid export for esbuild cjs and ts-node esm
// this causes a warning in esbuild
if typeof module !== 'undefined'
// So we can `civetPlugin = require "@danielx/civet/esbuild-plugin"`
module.exports = civet
module.exports.default = civet
// So ts-node can `import ./source/esbuild-plugin.civet`
export default civet

0 comments on commit feef2ed

Please sign in to comment.