There are special requirements that require the use of syntax that is prohibited in strict mode and results in an error, so avoid building the result with
Compile the build without adding use strict
babel-loader set strictMode=false
babel-loader handles module transformations via
@babel/helper-module-transforms, which provides a configuration parameter
strictMode to specify whether to compile to strict mode, which defaults to
use strict is added by default. This is shown in the figure below.
This behavior can be prevented by explicitly specifying the value of this parameter as
false in the configuration entry for
TypeScript compiler option setting noImplicitUseStrict
In addition to
TypeScript also turns on strict mode by default with the configuration parameter
noImplicitUseStrict. Set this parameter to true in the compile options of the tsconfig.json file to disable this feature. Example.
Remove the existing use strict
The compile configuration can only specify that
ts-loader do not add
use strict to their output, but it does not solve the case where it already exists in the dependency file. There is also logic inside
webpack to add
use strict to ESmodule references, and it is not that easy to remove it.
But we can remove it by writing a