Marko: Is renaming destruction import suppose to work?

Created on 2 Jan 2017  路  5Comments  路  Source: marko-js/marko

Bug Report

Context

Renaming destruction imports are not working in v4.0-beta.5 :

<import { client: twilio } from '../../lib/twilio.js' />

results in compilation error, while

<script template-helpers>
  const { client: twilio } = require('../../lib/twilio.js');
</script>

works fine...

Most helpful comment

But you can use as for aliases:

import { client as twilio } from '../../lib/twilio'

All 5 comments

I agree that this should be supported.

But you can use as for aliases:

import { client as twilio } from '../../lib/twilio'

Sorry, my fault, I forgot ES6 syntax while doing refactoring for <import> from require. Thank you!

I wrote up a fix to support colon destructuring as it's supported in standard JS destructuring. I actually didn't know that colon destructuring is not supported in import destructuring, which I find quite surprising and inconsistent. I rejected my PR. This issue should be closed. /cc @patrick-steele-idem

We want to strictly follow the ES6 import syntax. Closing this issue. Thanks.

Was this page helpful?
0 / 5 - 0 ratings