Skip to content

Commit

Permalink
feat: Support format and target
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Jul 25, 2023
1 parent adc3ec4 commit 50bfa01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
7 changes: 4 additions & 3 deletions test/esbuild.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Test', () => {
bundle: true,
format: 'cjs',
publicPath: 'http://invalid/assets',
plugins: [is()],
plugins: [is({ format: 'esm' })],
platform: 'node',
})
.then(() => {
Expand All @@ -61,7 +61,7 @@ describe('Test', () => {
bundle: true,
format: 'cjs',
publicPath: 'http://invalid/assets',
plugins: [is()],
plugins: [is({ format: 'esm' })],
platform: 'node',
logLevel: 'silent',
})
Expand Down Expand Up @@ -109,7 +109,8 @@ describe('Test', () => {
publicPath: 'http://invalid/assets',
plugins: [
is({
plugins: [is()],
format: 'esm',
plugins: [is({ format: 'esm' })],
}),
],
platform: 'node',
Expand Down

0 comments on commit 50bfa01

Please sign in to comment.