Strict mode soft reject. Please help me to understand.

javascript

#1

Hi there!

I submit my second item written in es6 and built with webpack and babel.
The sources are only 2 files with 2 simple classes.

In dist folder I put the minified result code generated by babel and webpack:

var Userpic=function(t){ ... };

In result file is no “use strict” at top.

I got a soft rejection with such text:
"1. STRICT MODE REQUIRED: All JavaScript should be written with “use
strict” mode on. Please note that strict mode is scoped. For concise
code it is recommened to placed"

Does it mean that I should add “use script” statement in minified result file?
My first item has the same structure and it was approved. I don’t understand why this one was rejected.

Thanks!


#2
(function($) {
	"use strict";

// your jquery codes here

});
})(jQuery);

#3

Thanks!

But I don’t use jquery and my question is about minified code: should i add “use strict” at top of the generated by webpack file?
Es6 modules should not use “use strict” statement, they are already in the strict mode.

For concise code it is recommened to placed — this part of rejection reason is unclear for me.


#4

Yes, you need to add. That’s why reviewers asking to update the file(s)


#5

Thank you!


#6

Hey, I’m getting the same response about ‘use strict’ and I’m also using ES6 and Webpack. Can you tell me what you ended up doing here to get this approved? Do they want to see this added to every function in every Module?


#7

Hi! I’ve added “user strict;” string at the top of the bundled file.
In webpack.config.js:

// ...
plugins: [
        // ...
        new webpack.BannerPlugin('"use strict";', { raw: true })
],
// ...

#8

Oh ok, would not have thought to do that way. I wonder why they’re wanting us to add this anyways since ES6 modules are already in strict mode according to the doc, .but if that’s what it takes to push it through I guess I’ll add it.