Giter VIP home page Giter VIP logo

Comments (6)

tbranyen avatar tbranyen commented on May 24, 2024

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

from diffhtml.

tbranyen avatar tbranyen commented on May 24, 2024

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]

from diffhtml.

justjake avatar justjake commented on May 24, 2024

Wait, how will running an example code in Node (which provides process globally) illustrate that process is (not) required? 😓

from diffhtml.

justjake avatar justjake commented on May 24, 2024

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:

  • npm install
  • npm run build
  • npx serve
  • Open the npx serve URL in your browser.

image

from diffhtml.

tbranyen avatar tbranyen commented on May 24, 2024

Looks like webpack does weird things when it sees process in modules, even when the reference is pulled from a module export and not the global scope. I renamed all the internal references to nodeProcess instead of process and the error goes away:

image

from diffhtml.

tbranyen avatar tbranyen commented on May 24, 2024

Kind of annoying fix, but it is important to support webpack defaults.

https://github.com/tbranyen/diffhtml/pull/270/files

from diffhtml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.