Issue 1:
Bug report

What is the current behavior?

When compiling typescript using ts-loader with webpack, the library variable is not hoisted to the global level, thereby not exposing it at all.

If the current behavior is a bug, please provide the steps to reproduce.

MWE at https://github.com/retorquere/webpack-mwe

With webpack 5.21.2, var MyModule = is declared at the top of the webpacked output; with 5.24.4, it is declared inside the IIFE and thus not available at the global level.

What is the expected behavior?

that the variable in output.library is declared in a way that it is available at the global level

Other relevant information:

webpack version: 5.21.2 vs 5.24.4

Node.js version: v15.5.0

Operating System: MacOS big sur

Additional tools: none

Issue 2:
Bug report

What is the current behavior?

Module build failed (from /home/circleci/project/node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: Cannot read property 'identifier' of null
at text.map.line (/home/circleci/project/node_modules/mini-css-extract-plugin/dist/loader.js:160:32)
at Array.map (<anonymous>)
at childCompiler.runAsChild (/home/circleci/project/node_modules/mini-css-extract-plugin/dist/loader.js:157:21)
at compile (/home/circleci/project/node_modules/webpack/lib/Compiler.js:306:11)
at hooks.afterCompile.callAsync.err (/home/circleci/project/node_modules/webpack/lib/Compiler.js:631:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:24:1)
at AsyncSeriesHook.lazyCompileHook (/home/circleci/project/node_modules/tapable/lib/Hook.js:154:20)
at compilation.seal.err (/home/circleci/project/node_modules/webpack/lib/Compiler.js:628:31)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/home/circleci/project/node_modules/tapable/lib/Hook.js:154:20)
at hooks.optimizeAssets.callAsync.err (/home/circleci/project/node_modules/webpack/lib/Compilation.js:1329:35)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/home/circleci/project/node_modules/tapable/lib/Hook.js:154:20)
at hooks.optimizeChunkAssets.callAsync.err (/home/circleci/project/node_modules/webpack/lib/Compilation.js:1320:32)
at _promise1.then._result1 (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:18:1)
at <anonymous>
@ ./style/index.ts 1:0-29
@ multi ./common/errorTracker ./common/polyfills ./style ./frames/about

If the current behavior is a bug, please provide the steps to reproduce.

My configuration is huge. I'd be happy to try and narrow down a minimal repro if necessary, but I hope that the error would be obvious given that this is a regression in a minor release. If it's not, just let me know.

What is the expected behavior?

There should be no error during build.

Other relevant information:

webpack version: 4.32.0

Node.js version: 8.9.0

Operating System: macOS 10.14.5

Additional tools: mini-css-extract-plugin 0.4.4