luxon icon indicating copy to clipboard operation
luxon copied to clipboard

Minified es6/luxon.min.js throws 'not a function or not iterable' for valid fromISO()

Open steve2507 opened this issue 3 years ago • 2 comments

Describe the bug

  • Consume https://moment.github.io/luxon/es6/luxon.min.js somewhere
  • Run DateTime.fromISO('2019-01-01T05:00:00.000')
  • Observe error:
TypeError: n is not a function or its return value is not iterable

Note that this runs perfectly fine with the non-minified es6 version.

To Reproduce Please share a minimal code example that triggers the problem:

import { DateTime } from 'https://moment.github.io/luxon/es6/luxon.min.js';
console.log(DateTime.fromISO('2019-01-01T05:00:00.000'));

Actual vs Expected behavior

  • Ensure behaviour is consistent between minified and non-minified version.
  • Ensure no error is thrown on valid fromISO formats (although in this case caused by the minifier).

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser: Chrome 103
  • Luxon version: latest
  • Your timezone: Europe/Zurich

Additional context Add any other context about the problem here.

steve2507 avatar Jul 05 '22 09:07 steve2507

Yeah, must be something up with the minifier

icambron avatar Jul 09 '22 16:07 icambron

In case you did want to switch back to Terser, I noticed a typo at: https://github.com/moment/luxon/blob/4fe7be9d5afa7afdf36b4bb9ad116d160c0881f5/tasks/build.js#L55

topLevel -> toplevel

https://terser.org/docs/api-reference#mangle-options

dasa avatar Jul 11 '22 21:07 dasa

Hi @icambron, can I take up this issue?

debadutta98 avatar Oct 25 '22 04:10 debadutta98

It might be worth investing whether microbundle is a viable option.

diesieben07 avatar Feb 27 '23 21:02 diesieben07

If we do go down the route of adding yet another place where the version string lives, let's be sure to update the release script to check that this additional location is the same as the others. There is already tooling to check that the version in the code matches the one in package.json.

icambron avatar Feb 28 '23 18:02 icambron