diff --git a/package.json b/package.json index bbbf664..688010a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@exact-realty/esbuild-plugin-inline-js", - "version": "1.1.2", + "version": "1.1.3", "description": "esbuild plugin for inline scripts", "main": "dist/index.js", "module": "./dist/index.mjs", diff --git a/src/index.ts b/src/index.ts index 41e719b..f28b4c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,13 +42,13 @@ export default ( async ({ path }) => { const outfile = randomBytes(9).toString('base64url'); const result = await esbuild.build({ + target: build.initialOptions.target, + format: build.initialOptions.format, ...config, entryPoints: [path], bundle: true, minify: true, outfile: outfile, - target: 'es2017', - format: 'esm', write: false, }); diff --git a/test/esbuild.test.ts b/test/esbuild.test.ts index 0528e15..da8aa98 100644 --- a/test/esbuild.test.ts +++ b/test/esbuild.test.ts @@ -34,7 +34,7 @@ describe('Test', () => { bundle: true, format: 'cjs', publicPath: 'http://invalid/assets', - plugins: [is()], + plugins: [is({ format: 'esm' })], platform: 'node', }) .then(() => { @@ -61,7 +61,7 @@ describe('Test', () => { bundle: true, format: 'cjs', publicPath: 'http://invalid/assets', - plugins: [is()], + plugins: [is({ format: 'esm' })], platform: 'node', logLevel: 'silent', }) @@ -109,7 +109,8 @@ describe('Test', () => { publicPath: 'http://invalid/assets', plugins: [ is({ - plugins: [is()], + format: 'esm', + plugins: [is({ format: 'esm' })], }), ], platform: 'node',