-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New process
definition in html-manager/webpack.config.js
conflicts with getOption
helper of @jupyterlab/coreultils
#3306
Comments
cc @martinRenou |
Just above these lines, there is the conditional: if (!found && typeof process !== 'undefined' && process.argv) { Since process.argv is undefined, how is this invoking the code you mention above? |
Hi @jasongrout, here is the output of if (!found)
try {
const cli = minimist_1.default({
cwd: ()=>"/"
}.argv.slice(2))
, path = __webpack_require__(21023);
let fullPath = "";
"jupyter-config-data"in cli ? fullPath = path.resolve(cli["jupyter-config-data"]) : "JUPYTER_CONFIG_DATA"in {} && (fullPath = path.resolve({}.JUPYTER_CONFIG_DATA)),
fullPath && (configData = eval("require")(fullPath))
} catch (e) {
console.error(e)
} And here is the output if I remove the if (!found && "undefined" != typeof process)
try {
const cli = minimist_1.default(process.argv.slice(2))
, path = __webpack_require__(21023);
let fullPath = "";
"jupyter-config-data"in cli ? fullPath = path.resolve(cli["jupyter-config-data"]) : "JUPYTER_CONFIG_DATA"in {} && (fullPath = path.resolve({}.JUPYTER_CONFIG_DATA)),
fullPath && (configData = eval("require")(fullPath))
} catch (e) {
console.error(e)
} Maybe |
Oh wow, that is very interesting. Yeah, why is webpack not transliterating that code and instead removing conditions? |
@trungleduc how can we reproduce this error? |
Sorry for my late reply, you can use |
Assigning myself |
Using the following polyfill: new webpack.DefinePlugin({
// Needed for Blueprint. See https://github.com/palantir/blueprint/issues/4393
'process.env': '{}',
// Needed for various packages using cwd(), like the path polyfill
'process.cwd': '() => "/"',
// Needed for various packages using argv(), like JupyterLab's getOption function
'process.argv': 'undefined'
}), It does not fail anymore, but the resulting if (!found && "undefined" != typeof process)
try {
const cli = minimist_1.default((void 0).slice(2))
, path = __webpack_require__(21023);
let fullPath = "";
"jupyter-config-data"in cli ? fullPath = path.resolve(cli["jupyter-config-data"]) : "JUPYTER_CONFIG_DATA"in {} && (fullPath = path.resolve({}.JUPYTER_CONFIG_DATA)),
fullPath && (configData = eval("require")(fullPath))
} catch (e) {
console.error(e)
} Though it doesn't go through the condition because process is not defined anymore. |
Description
The
process
variable defined inhtml-manager
webpack configurationipywidgets/packages/html-manager/webpack.config.js
Lines 65 to 70 in 9326d28
is also used in
getOption
helper of@jupyterlab/coreultils
since this variable will be replaced with value defined in webpack configuration at compile time, this leads to the output of the
html-manager
bundle is:which will obviously raise an error since
{cwd: ()=>"/"}.argv
isundefined
Reproduce
Build
html-manager
and search forconst cli
indist/embed.js
Expected behavior
The correct output should be:
Context
master
The text was updated successfully, but these errors were encountered: