babel / babel/minify

Unnecessary space between adjacent comments

Open
#912 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.4k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

There is unnecessary whitespace between adjacent comments when they are preserved using `shouldPrintComment` callback or `comments: true` option.

**To Reproduce**

```javascript
/* First comment *//* Second comment */
```

**Actual Output**

```javascript
/* First comment */ /* Second comment */
```

**Expected Output**

```js
/* First comment *//* Second comment */
```

**Configuration**

How are you using babel-minify?

`babel-preset-minify` in `babel.config.js` (but reproducible also using Babel Node API)

babel-minify version: `0.5.0`

babel version : `7.1.2`

babel-minify-config:

```json5
{
}
```

`babel.config.js`:

```javascript
module.exports = function ( api ) {
api.cache( true );

return {
presets: [
'minify'
],

shouldPrintComment() {
return true;
}
};
}
```

**Additional context**

Created [minimal reproduction](https://github.com/Comandeer/bugs-reports/tree/babel-minify-comments).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.