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
3 changes: 2 additions & 1 deletion packages/fluent-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
"opentiny",
"fluent-editor"
],
"type": "module",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the impact of enabling ES modules.

Adding "type": "module" changes how Node.js interprets .js files as ES modules by default. This could affect:

  • Existing .js files that use CommonJS syntax
  • Import/export statements throughout the codebase
  • Scripts that aren't ready for ESM

Let's verify the codebase compatibility:


🏁 Script executed:

#!/bin/bash
# Check for potential CommonJS syntax in .js files that might break
echo "Checking for require() calls in .js files..."
rg "require\(" --type js

echo "Checking for module.exports in .js files..."
rg "module\.exports" --type js

echo "Checking for __dirname/__filename usage in .js files..."
rg "__dirname|__filename" --type js

Length of output: 580


ESM Package: Potential Compatibility Issues with CommonJS Scripts

The addition of "type": "module" in package.json means that .js files are now treated as ES modules by default, which could break files still written using CommonJS syntax. We found that:

  • verifyCommit.js uses require() to import modules.
  • jest.config.js uses module.exports.

These patterns will lead to runtime issues unless those files are either renamed to use a .cjs extension (as done for the pre-release script) or are refactored to use ES module syntax.

"main": "src/index.ts",
"module": "src/index.ts",
"types": "types/index.d.ts",
"scripts": {
"start": "vite build && vite",
"dev": "vite",
"build": "pnpm build:theme && vite build && node scripts/pre-release.js",
"build": "pnpm build:theme && vite build && node scripts/pre-release.cjs",
"build:theme": "vite build --config vite.config.theme.ts",
"test": "jest"
},
Expand Down