Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ jobs:
- run: npx biome check

- run: npx playwright install && npm run test

- run: npm run build && node scripts/smoke-test-dist.mjs
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-compare-image",
"version": "3.5.16",
"version": "3.5.17",
"description": "React component to compare two images using slider.",
"main": "./dist/ReactCompareImage.umd.js",
"module": "./dist/ReactCompareImage.mjs",
Expand Down
27 changes: 27 additions & 0 deletions scripts/smoke-test-dist.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node
import { readFileSync } from 'node:fs'

// This test ensures no unnecessary dependencies are bundled into the built output
// like `react/jsx-runtime` or `react/jsx-dev-runtime`.
// https://github.com/tam315/react-compare-image/issues/153

const DIST_FILE = 'dist/ReactCompareImage.mjs'

let content
try {
content = readFileSync(DIST_FILE, 'utf-8')
} catch {
console.error(`ERROR: ${DIST_FILE} not found. Run "npm run build" first.`)
process.exit(1)
}

const FORBIDDEN = ['react.transitional.element', 'react.element']

for (const symbol of FORBIDDEN) {
if (content.includes(symbol)) {
console.error(`FAIL: "${symbol}" found in ${DIST_FILE}`)
process.exit(1)
}
}

console.log(`PASS: No forbidden React symbol strings found in ${DIST_FILE}`)
2 changes: 1 addition & 1 deletion vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineConfig({
fileName: 'ReactCompareImage',
},
rollupOptions: {
external: ['react', 'react-dom'],
external: ['react', 'react-dom', 'react/jsx-runtime'],
output: {
globals: {
react: 'React',
Expand Down
Loading