[js/web] disable node fallback in webpack (#16166)

### Description
disable webpack's polyfill for node's `global`, `__filename` and
`__dirname` in web build. This will confuse emscripten generated
environment detection.

see https://webpack.js.org/configuration/node/
This commit is contained in:
Yulong Wang 2023-05-31 16:47:00 -07:00 committed by GitHub
parent 13d6ac74de
commit f67f7c0f0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,7 +49,7 @@ function defaultTerserPluginOptions(target) {
passes: 2
},
mangle: {
reserved: ["_scriptDir","startWorker"]
reserved: ["_scriptDir", "startWorker"]
}
}
};
@ -111,6 +111,7 @@ function buildConfig({ filename, format, target, mode, devtool, build_defs }) {
}]
},
mode,
node: false,
devtool
};
@ -268,8 +269,9 @@ function buildTestRunnerConfig({
type: 'asset/source'
}]
},
mode: mode,
devtool: devtool,
mode,
node: false,
devtool,
};
if (mode === 'production') {