Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Impossible to use loose mode for classes #47

Closed
developit opened this issue Apr 16, 2016 · 7 comments
Closed

Impossible to use loose mode for classes #47

developit opened this issue Apr 16, 2016 · 7 comments

Comments

@developit
Copy link

developit commented Apr 16, 2016

L20 makes it impossible to use the class transformer's loose specified by presets passed to rollup-plugin-babel. This is because the class transform is manually added to the plugins list, which takes precedence over preset-provided plugins.

Is this intentional? If not, what about something like this?

const classCheck = transform( 'class Foo {}', options ).code;
if (~classCheck.indexOf('class Foo')) {
    options.plugins.push( classes );
}
@Rich-Harris
Copy link
Contributor

Hmm – no, it looks like the options should get cloned rather than mutated. Most likely an oversight on my part...

@developit
Copy link
Author

@Rich-Harris If I manually specify ['transform-es2015-classes', { loose:true }] in options.plugins, I get loose mode classes. I'm only seeing the issue when a preset specifies loose mode, such as this one.

@eventualbuddha
Copy link
Contributor

This appears to no longer exhibit the same problem, so I'm closing. Please comment if I have that wrong.

@eventualbuddha
Copy link
Contributor

Actually, I think it may still be a problem.

@eventualbuddha eventualbuddha reopened this Jun 7, 2016
@developit
Copy link
Author

@eventualbuddha confirmed, still an issue. Tested by removing these transforms in preact-svg, which generates strict mode class output at dist/preact-svg.js.

@Rich-Harris
Copy link
Contributor

Just released 2.5.1 which no longer mutates plugins – can you verify that it behaves correctly please? thanks

@developit
Copy link
Author

@Rich-Harris Confirmed, it's fixed! Thanks muchly.

developit added a commit to developit/preact-svg that referenced this issue Jun 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants