Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules should be strict #1434

Closed
mgol opened this issue May 4, 2015 · 7 comments
Closed

Modules should be strict #1434

mgol opened this issue May 4, 2015 · 7 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@mgol
Copy link

mgol commented May 4, 2015

According to the ES6 spec, modules have implicit strict mode. Babel should add 'use strict'; pragmas to transpiled modules; it doesn't do it either for the common output nor for the amd one.

@sebmck
Copy link
Contributor

sebmck commented May 4, 2015

it doesn't do it either for the common output nor for the amd one.

Yes it does?

@sebmck sebmck closed this as completed May 4, 2015
@mgol
Copy link
Author

mgol commented May 4, 2015

Am I doing sth wrong?

a.js:

import b from './b';

b.js:

export default 'b';

And yet:

$ babel --version
5.2.9
$ babel --whitelist es6.modules a.js --modules common                              
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _b = require('./b');

var _b2 = _interopRequireDefault(_b);

@sebmck
Copy link
Contributor

sebmck commented May 4, 2015

You're using the whitelist so the strict transformer is being disabled.

@mgol
Copy link
Author

mgol commented May 4, 2015

I see. It seems es6.modules should imply strict, though as it's part of the semantics.

Is using a whitelist discouraged?

@sebmck
Copy link
Contributor

sebmck commented May 4, 2015

Depends on your usage, but generally using the whitelist is pointless since it wont speed up compilation which is what 90% of people use it for.

@mgol
Copy link
Author

mgol commented May 4, 2015

I use it mainly so that I don't transpile features that work on current io.js.

@sebmck
Copy link
Contributor

sebmck commented May 4, 2015

There are more features unavailable on io.js so it'd be easier to just use the blacklist.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 20, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

2 participants