From 33de74b37114a64c4fa3fbc1e78d9d2a988f6dc7 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 25 Feb 2021 11:33:12 -0500 Subject: [PATCH 1/3] Remove module tag. Now interpreted as commonjs --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 6b9cdb8..4e9b0e0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "license": "ISC", "exports": "./src/index.js", "main": "src/index.js", - "type": "module", "scripts": { "format": "prettier --write --ignore-unknown '**/*'" }, From 2ae2cd3f9484c8e5619e7d624589e54a2e2255e8 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 25 Feb 2021 11:34:48 -0500 Subject: [PATCH 2/3] Use `require` statements over `import` --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index b3cff90..e6c9a1b 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ -import babel from '@babel/core'; -import fs from 'fs'; -import path from 'path'; +const babel = require('@babel/core'); +const fs = require('fs'); +const path = require('path'); const pluginBabel = (options = {}) => ({ name: 'babel', @@ -41,4 +41,4 @@ const pluginBabel = (options = {}) => ({ } }); -export default pluginBabel; +module.exports = pluginBabel; From 40106e72776cf4e2e4da8e52926632ceed378da0 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 16 Jun 2021 12:06:00 -0400 Subject: [PATCH 3/3] Return `void` type Ref: https://github.com/evanw/esbuild/blob/223150f924d746226eedd703d7419dfa636c642f/lib/shared/types.ts#L189 --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index e6c9a1b..44e733b 100644 --- a/src/index.js +++ b/src/index.js @@ -16,7 +16,7 @@ const pluginBabel = (options = {}) => ({ supportsStaticESM: true } }); - if (!babelOptions) return { contents }; + if (!babelOptions) return; if (babelOptions.sourceMaps) { const filename = path.relative(process.cwd(), args.path);