Bug report
What is the current behavior?
Using a combination of globalObject: 'this' and runtimeChunk: 'single' in webpack.config.js causes the following error when including the generated code in a browser:
TypeError: undefined is not an object (evaluating 'this["webpackChunkMyLibrary"]')
This issue started on Webpack v5.47.0. I believe it was caused likely caused by this commit:
0bd1e78#diff-820a04017e95cec05fd58ca44cd7f6c9cfa5b698a144471d5a0f523932486c56R619
If the current behavior is a bug, please provide the steps to reproduce.
See https://github.com/jluxenberg/webpack-use-strict-bug-report for full reproduction instructions.
My webpack.config.js:
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
library: 'MyLibrary',
libraryTarget: 'umd',
globalObject: 'this',
},
optimization: {
minimize: false,
runtimeChunk: 'single',
},
};
What is the expected behavior?
I see the text "hello world" printed to the console when including the generated runtime.js and main.js files.
Other relevant information:
webpack version: bug occurs starting with v5.47.0. I tested with latest (v5.70.0) as well.
Node.js version: N/A
Operating System: MacOS 12.1 Monterey
Additional tools:
Bug report
What is the current behavior?
Using a combination of
globalObject: 'this'andruntimeChunk: 'single'inwebpack.config.jscauses the following error when including the generated code in a browser:This issue started on Webpack v5.47.0. I believe it was caused likely caused by this commit:
0bd1e78#diff-820a04017e95cec05fd58ca44cd7f6c9cfa5b698a144471d5a0f523932486c56R619
If the current behavior is a bug, please provide the steps to reproduce.
See https://github.com/jluxenberg/webpack-use-strict-bug-report for full reproduction instructions.
My
webpack.config.js:What is the expected behavior?
I see the text "hello world" printed to the console when including the generated
runtime.jsandmain.jsfiles.Other relevant information:
webpack version: bug occurs starting with v5.47.0. I tested with latest (v5.70.0) as well.
Node.js version: N/A
Operating System: MacOS 12.1 Monterey
Additional tools: