brunch / deppack

Extract node modules to browser.
MIT License
4 stars 13 forks source link

Cannot find module 'buffer' from 'lodash/isBuffer.js' #48

Closed StarpTech closed 2 years ago

StarpTech commented 6 years ago

Hi, I run into this issue when I want to initialize my app in the browser. It's curious because It appears suddenly after a fresh npm install.

vendor.js:61 Uncaught Error: Cannot find module 'buffer' from 'lodash/isBuffer.js'
    at require (vendor.js:61)
    at expanded (vendor.js:34)
    at vendor.js:147
    at isBuffer.js:4
    at initModule (vendor.js:42)
    at require (vendor.js:59)
    at expanded (vendor.js:34)
    at vendor.js:147
    at _arrayLikeKeys.js:8
    at _arrayLikeKeys.js:54

image

package.json

{
  "name": "webapp",
  "private": true,
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "brunch watch",
    "build": "brunch build --production"
  },
  "dependencies": {
    "bulma": "^0.6.1",
    "chartist": "^0.11.0",
    "es6-promise": "^4.1.1",
    "font-awesome": "^4.7.0",
    "isomorphic-fetch": "^2.2.1",
    "leaflet.markercluster": "^1.2.0",
    "leaflet": "^1.2.0",
    "prop-types": "^15.6.0",
    "react": "^16.2.0",
    "react-chartist": "^0.13.0",
    "react-dom": "^16.2.0",
    "react-leaflet": "^1.7.8",
    "styled-components": "^2.3.0"
  },
  "devDependencies": {
    "auto-reload-brunch": "^2.7.1",
    "autoprefixer": "^7.2.3",
    "babel-brunch": "~6.1.1",
    "babel-plugin-styled-components": "^1.3.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-latest": "^6.24.1",
    "babel-preset-react": "~6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "brunch": "^2.10.12",
    "clean-css-brunch": "^2.10.0",
    "copycat-brunch": "^1.1.0",
    "csswring": "^6.0.2",
    "eslint": "^4.13.1",
    "eslint-brunch": "^3.12.0",
    "eslint-plugin-react": "^7.5.1",
    "postcss-brunch": "^2.1.0",
    "prettier": "^1.9.2",
    "sass-brunch": "^2.10.4",
    "uglify-js-brunch": "^2.10.0"
  },
  "keywords": [],
  "license": "ISC"
}
StarpTech commented 6 years ago

That's the condition https://github.com/brunch/deppack/blob/b7f36a26ff89da7ad6d3af2d2e9c75eca6f369d6/lib/shims.js#L33 when I remove the injected code it works.

natewallis commented 5 years ago

I am also having this issue on an intermittment basis.... can't quite figure it out... I assume this is because lodash has references to buffer in the code...

jiixing commented 4 years ago

I fixed this by adding 'buffer' package in my package.json

paulmillr commented 2 years ago

We don't use npm builtins now