Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

I have modules that do not export es6 style but need to be transformed #1

Closed
elevatebart opened this issue May 17, 2017 · 9 comments
Closed
Milestone

Comments

@elevatebart
Copy link

Why limit the transforms to files that contain import and exports ES6 style like so ?

if(isEs6(context.js.ast)){
    ...
}

Why not simply babel every file ?
I am trying to use the delay library in a Karma-Typescript context and the testing returns a parsing error at bundling even with your transform.

Can you help me figure it out ?

@erikbarke
Copy link
Collaborator

Hey @elevatebart, I'll take a look!

@elevatebart
Copy link
Author

elevatebart commented May 17, 2017

I was even nicer, I created a pull request #2.
Hope you like it ;-)

erikbarke added a commit that referenced this issue May 18, 2017
@erikbarke
Copy link
Collaborator

Thanks!! Unfortunately #2 broke a lot of things including the integration tests in karma-typescript... I've improved the ES6 detection by looking for more keywords recursively and I have a successful integration test in karma-typescript locally that requires the delay module.

Does it work for you too if you install the latest from master, npm i github:monounity/karma-typescript-es6-transform?
If you’re behind a firewall and can’t install from GitHub, you can download the branch as a zip and install manually.

@elevatebart
Copy link
Author

elevatebart commented May 18, 2017

Do you know where I could have access to these integration tests so that I can make sure that my branch does not break them before I go ahead and submit anything else. The first issue with delay was the use of an arrow expression () => 'the return';

@elevatebart
Copy link
Author

elevatebart commented May 18, 2017

Just to be clear, your changes fixed my initial issue which was to be able to use 'delay'.
But if the module I import from npm is built as follows

module.export = () => {
    return "test";
}

the bundling will probably fail.

erikbarke added a commit that referenced this issue May 18, 2017
erikbarke added a commit to monounity/karma-typescript that referenced this issue May 18, 2017
erikbarke added a commit to monounity/karma-typescript that referenced this issue May 18, 2017
@erikbarke
Copy link
Collaborator

erikbarke commented May 18, 2017

Ok, I've added support for fat arrow functions too with a unit test containing your example!
Also, the integration tests are referenced above if you want to take a look.
Thanks for reporting this and coming up with suggestions 😃

@elevatebart
Copy link
Author

it's working like a charm !!! thank you !!!

@elevatebart
Copy link
Author

elevatebart commented May 18, 2017

We tested it on our side and we love it. The last thing we need is npm publish and we are all set !!!
Do not forget to increase the minor package number ;-).

Once this is done, you can close the issue.

@erikbarke erikbarke added this to the 1.0.1 milestone May 19, 2017
erikbarke added a commit that referenced this issue May 19, 2017
@erikbarke
Copy link
Collaborator

On npm now!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants