Skip to content

Commit

Permalink
Support css content in esbuild plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
just-boris committed Mar 21, 2024
1 parent 2d063b9 commit feb3873
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/esbuild/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getFiles(buildResult, check) {
let outputs = buildResult.metafile.outputs

for (let key in outputs) {
let outputEntryName = parse(key).name
let outputEntryName = parse(key).base
outputs[outputEntryName] = outputs[key]
outputs[outputEntryName].path = resolve(key)
delete outputs[key]
Expand Down
2 changes: 2 additions & 0 deletions packages/esbuild/test/fixtures/esm/nonjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './file.js'
import './style.css'
3 changes: 3 additions & 0 deletions packages/esbuild/test/fixtures/esm/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a {
color: black
}
8 changes: 8 additions & 0 deletions packages/esbuild/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ it('uses esbuild to make bundle', async () => {
expect(existsSync(config.checks[0].esbuildOutfile)).toBe(false)
})

it('supports bundles with css', async () => {
let config = {
checks: [{ files: fixture('esm/nonjs.js') }]
}
await run(config)
expect(config.checks[0].size).toBe(49)
})

it('supports ignore', async () => {
let config = {
checks: [{ files: fixture('cjs/big.js'), ignore: ['redux'] }]
Expand Down

0 comments on commit feb3873

Please sign in to comment.