Commit cb72001
committed
fix(build): fix CommonJS export script edge cases
Fixed two issues in fix-commonjs-exports.mjs:
1. Stray semicolons after comment placeholders
- Now properly consumes the semicolon when replacing module.exports statement
- Prevents: `/* module.exports will be set at end of file */;`
2. Double module prefix in module.exports.default
- Skip transformation when 'exports.default' is already preceded by 'module.'
- Prevents: `module.module.exports` (was incorrectly transforming `module.exports.default`)
These fixes ensure external dependencies like yoctocolors-cjs export correctly
and modules with export default work without errors.1 parent 5bddd43 commit cb72001
1 file changed
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
230 | 244 | | |
231 | 245 | | |
232 | | - | |
| 246 | + | |
233 | 247 | | |
234 | 248 | | |
235 | 249 | | |
| |||
244 | 258 | | |
245 | 259 | | |
246 | 260 | | |
| 261 | + | |
247 | 262 | | |
248 | 263 | | |
249 | 264 | | |
250 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
251 | 273 | | |
252 | 274 | | |
253 | 275 | | |
| |||
0 commit comments