-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Closed
Copy link
Description
Bug report
What is the current behavior?
- When using BannerPlugin with
rawoption, it appends the code before"use strict", this will cause strict mode to not function properly. - When set
minimizeto true,TerserPluginwill remove"use strict"in between.
Context: Before #13842, webpack add "use strict" inside each function, so we don't have this issue. But after this, webpack seems like shift all "use strict" to the top, that's the root cause of this issue.
If the current behavior is a bug, please provide the steps to reproduce.
Repo to reproduce the bug: https://github.com/anothertempore/webpack-banner-use-strict
Steps:
- clone the repo
- run
pnpm install - run
pnpm build, then checkdist/asyncfile,"use strict"is not in the very first line, which is incorrect. - change this line to true, then check
dist/async,"use strict"will be removed.
What is the expected behavior?
"use strict" statement should always in the very first line.
Other relevant information:
webpack version: 5.90.3
Node.js version: 18
Operating System: MacOS
Additional tools:
kenrick95