Skip to content
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

Regression: @^1.0.0 works with browserify, @^3.0.0 doesn’t #6

Open
aral opened this issue Nov 13, 2020 · 0 comments
Open

Regression: @^1.0.0 works with browserify, @^3.0.0 doesn’t #6

aral opened this issue Nov 13, 2020 · 0 comments

Comments

@aral
Copy link

aral commented Nov 13, 2020

To reproduce

# Ensure browserify is installed globally
npm i -g browserify

# Set up the project
mkdir browserify-regression && cd browserify-regression
npm init -f

# Install version ^1.0.0
npm i eff-diceware-passphrase@^1.0.0

# Create the script
echo 'const diceware = require("eff-diceware-passphrase")\nalert(dicew
are.entropy(100).join(" "))' > main.js 

# Create the index
echo '<script src='bundle.js'></script>' > index.html

# Create bundle
browserify main.js -o bundle.js

# Install Site.js (or serve the folder in your own favourite web server).
curl -s https://sitejs.org/install | bash

# Run Site.js on the current folder.
site

Hit https://localhost and you should see an alert with the passphrase in it.

Now, let’s try the same thing with ^3.0.0:

npm i eff-diceware-passphrase@^3.0.0
browserify main.js -o bundle.js
site

Hit https://localhost again.

What should happen

You should see the passphrase in an alert, as before.

What actually happens

You get the following error:

Uncaught TypeError: Path must be a string. Received undefined
    assertPath https://localhost/bundle.js:84
    dirname https://localhost/bundle.js:349
    path https://localhost/bundle.js:946
    load https://localhost/bundle.js:924
    [15]</</< https://localhost/bundle.js:1173
    [15]</< https://localhost/bundle.js:1177
    [15]< https://localhost/bundle.js:1177
    o https://localhost/bundle.js:1
    o https://localhost/bundle.js:1
    [11]< https://localhost/bundle.js:1076
    o https://localhost/bundle.js:1
    o https://localhost/bundle.js:1
    [13]< https://localhost/bundle.js:1129
    o https://localhost/bundle.js:1
    o https://localhost/bundle.js:1
    [7]< https://localhost/bundle.js:835
    o https://localhost/bundle.js:1
    o https://localhost/bundle.js:1
    [5]< https://localhost/bundle.js:774
    o https://localhost/bundle.js:1
    r https://localhost/bundle.js:1
    <anonymous> https://localhost/bundle.js:1
bundle.js:84:11

Additional information

  • I’ve noted the same behaviour with Snowpack (works with ^1.0.0, fails with ^3.0.0).

  • Attached is a diff between the working bundle generated with version ^1.0.0 and the non-working one, genereated with version ^3.0.0, in case it helps: bundle.js.diff.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant