Closed ryanlewis closed 2 years ago
We have encountered this issue as well with the date-fns library served through the ClientDependency handler (see parse/index.js in the date-fns package).
var isDate = require('../is_date/index.js')
var MILLISECONDS_IN_HOUR = 3600000
var MILLISECONDS_IN_MINUTE = 60000
var DEFAULT_ADDITIONAL_DIGITS = 2
var parseTokenDateTimeDelimeter = /[T ]/
var parseTokenPlainTime = /:/
// year tokens
var parseTokenYY = /^(\d{2})$/
var parseTokensYYY = [
/^([+-]\d{2})$/, // 0 additional digits
/^([+-]\d{3})$/, // 1 additional digit
/^([+-]\d{4})$/ // 2 additional digits
]
var parseTokenYYYY = /^(\d{4})/
var parseTokensYYYYY = [
/^([+-]\d{4})/, // 0 additional digits
/^([+-]\d{5})/, // 1 additional digit
/^([+-]\d{6})/ // 2 additional digits
]
How does people workaround this issue?
The following valid JavaScript produces invalid minified code (note there's no trailing semi-colon):
In my testing this returns
This throws an error about incorrect regex flags.
While use of semi-colons in JS is a religous issue, we still don't want to produce invalid JavaScript here. I propose a trailing semi-colon is added to a line if it ends with a slash.
There may be other cases where this is an issue.