-
Notifications
You must be signed in to change notification settings - Fork 47
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
diffhtml: process
is not defined
#268
Comments
Do you know where this is happening? export default typeof process !== 'undefined' ? process : {
env: /** @type {Config} */({ NODE_ENV: 'development' }),
argv: /** @type {string[]} */ ([]),
}; We already should be guarding against undefined it seems. Edit: NVM I see #269 |
I created a reduced test case and can't reproduce this behavior: tim in ~/tmp/tmp.Fymt36hUrW on from-work-laptop
λ cat package.json
{
"dependencies": {
"diffhtml": "^1.0.0-beta.27",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2"
}
}
tim in ~/tmp/tmp.Fymt36hUrW on from-work-laptop
λ cat index.js
import { innerHTML } from 'diffhtml';
console.log(innerHTML);
tim in ~/tmp/tmp.Fymt36hUrW on from-work-laptop
λ webpack ./index.js
asset main.js 24.2 KiB [compared for emit] [minimized] (name: main)
orphan modules 111 KiB [orphan] 34 modules
runtime modules 670 bytes 3 modules
./index.js + 34 modules 111 KiB [built] [code generated]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
webpack 5.72.0 compiled with 1 warning in 921 ms
tim in ~/tmp/tmp.Fymt36hUrW on from-work-laptop
λ node ./dist/main.js
[Function: Fe] |
Wait, how will running an example code in Node (which provides |
Here's a repo with the repro steps you tried, plus an HTML page for trying out the bundle Webpack produces: https://github.com/justjake/diffhtml-repro Instructions to repro:
|
This fixes GH-268. Webpack has issues with the process variable and by renaming the internal usage we can ensure that it points to our representation and not the external one.
Kind of annoying fix, but it is important to support webpack defaults. |
This fixes GH-268. Webpack has issues with the process variable and by renaming the internal usage we can ensure that it points to our representation and not the external one.
* Rename process to internalProcess This fixes GH-268. Webpack has issues with the process variable and by renaming the internal usage we can ensure that it points to our representation and not the external one. * Ensure rollup respects the symbol change
The check for
process.env
breaks unless I use Webpack'sDefinePlugin
to replace theprocess.env
check in diffhtml's source during build.Consider first checking
if typeof process !== 'undefined')
.The text was updated successfully, but these errors were encountered: