Giter VIP home page Giter VIP logo

deppack's Issues

Improperly-cased require error when built-in modules shimmed

I'm trying brunch on a legacy code base, and failing because:

30 Mar 04:29:27 - error: 

Resolving deps of node_modules/open/lib/open.js failed.
Improperly-cased require: 'child_process' in /tmp/test/node_modules/open/lib/open.js ; 

Resolving deps of node_modules/joi/lib/string.js failed.
Improperly-cased require: 'net' in /tmp/test/node_modules/joi/lib/string.js ; 

Resolving deps of node_modules/bindings/bindings.js failed.
Improperly-cased require: 'fs' in /tmp/test/node_modules/bindings/bindings.js ; 

Resolving deps of node_modules/glue/node_modules/joi/lib/string.js failed.
Improperly-cased require: 'net' in /tmp/test/node_modules/glue/node_modules/joi/lib/string.js ; 

Resolving deps of node_modules/hapi/node_modules/joi/lib/string.js failed.
Improperly-cased require: 'net' in /tmp/test/node_modules/hapi/node_modules/joi/lib/string.js ; 

Resolving deps of node_modules/hapi/node_modules/subtext/lib/index.js failed.
Improperly-cased require: 'fs' in /tmp/test/node_modules/hapi/node_modules/subtext/lib/index.js 

(I've inserted newlines to aid readability at the expense of length.)

Each hits checkImproperCase with res set to ___shims___ plus the module name, e.g. ___shims___/fs. trueCasePath(res) evaluates to undefined. I'm not yet sure why the shims are there, but adding a check against undefined gets me past the problem.

When using TypeScript dependencies from node_modules are not bundled.

None of my required files make it into the bundle if they're from node_modules. I've tracked this down to the function isJs in lib/explore.js:

const isJs = (fileList, path) => {
  const file = fileList.files.get(path);
  return file && file.type === 'javascript';
};

Because my paths are being transformed (eg: js/views/not_found.tsx to js/views/not_found.js) this function does not work correctly. I've been able to fix the issue by changing it to:

const isJs = (fileList, path) => {
  return /\.(js|ts|tsx|jsx)/.test(path);
};

Oddly, this issue only emerged after I switched to a fork of typescript-brunch (specifically this) and when I try to switch back to the official package the problem persists. I've even gone as far as wiping my node_modules folder and redownloading all of my dependencies.

error when processing .js file that has .json substring

Found a bug when including core-js package in brunch

This package has two files with .json substring in it

https://github.com/zloirock/core-js/blob/ae33634b34/packages/core-js/modules/es.json.stringify.js
https://github.com/zloirock/core-js/blob/ae33634b34/packages/core-js/modules/es.json.to-string-tag.js

The code in

if (filePath.indexOf('.json') === -1) {

should be changed to

  if (filePath.endsWith('.json') === false) {

ReferenceError: msg is not defined

msg is undefined as it's dependant on data existing to be defined.

brunch watch --server

29 Jul 16:07:45 - info: application started on http://localhost:3333/
29 Jul 16:07:49 - info: compiling
29 Jul 16:07:55 - info: compiling.
/Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/deppack/lib/resolve.js:68
  err = new Error(msg);
                  ^

ReferenceError: msg is not defined
  at glob.then.mods.forEach.friendlyRequireError (/Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/deppack/lib/resolve.js:68:19)
  at /Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/deppack/lib/resolve.js:90:17
  at /Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/browser-resolve/index.js:265:24
  at /Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/resolve/lib/async.js:55:18
  at load (/Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/resolve/lib/async.js:69:43)
  at onex (/Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/resolve/lib/async.js:92:31)
  at /Users/[USERNAME]/Workspace/[PROJECT_NAME]/node_modules/resolve/lib/async.js:22:47
  at FSReqWrap.oncomplete (fs.js:82:15)

possibility to disable envify for selected files?

this particular string

  return '\n    If you using \'express-graphql\', you may get server stack-trace for error.\n    Just tune \'formatError\' to return \'stack\' with stack-trace:\n\n    import graphqlHTTP from \'express-graphql\';\n\n    const graphQLMiddleware = graphqlHTTP({\n      schema: myGraphQLSchema,\n      formatError: (error) => ({\n        message: error.message,\n        stack: process.env.NODE_ENV === \'development\' ? error.stack.split(\'\\n\') : null,\n      })\n    });\n\n    app.use(\'/graphql\', graphQLMiddleware);';

when envified will break acorn as process.env.NODE_ENV is getting changed to 'development'

requiring relative css file doesn't work

I was trying to use the css-brunch plugin but using require('./styles.css') shows the following error

03 Apr 22:36:26 - error: Resolving deps of app/initialize.js failed. Could not load module 'styles.css' from '/home/marcio/workspace/javascript/test-brunch/app'. Possible solution: add 'styles.css' to package.json and `npm install`

Using require with js files works fine.

Diving into the code I found out that this problem might be related with the following lines here

deps = allDeps.map(d => helpers.isRelative(d) ? sysPath.relative('.', sysPath.resolve(sysPath.dirname(nameCleaner(path)), d)) : d);

When computing the dependencies from initialize.js file, the allDeps variable changes from ['./styles.css'] to ['styles.css']. Afterward this array is passed to browser-resolve which throws the error. I changed the code manually to preserve the ['./styles.css'] behavior and everything worked fine.
But it's not clear to me what this line is suppose to do. So I'm opening an issue here, since this looks like a bug.

Issue explicit error on shim failure

If shimming child_process, dns, fs, net etc:

  • shimAliases passes undefined to generateFileBasedModuleName
  • … which passes it to getModuleFullRootName
  • … which tries to call path.split despite path being undefined

The root cause is shimming the un-shimmable. Troubleshooting would be easier if shimAliases' reducer did something like:

const shim = shims.fileShims[x];
assert.notEqual(shim, undefined, `no shim available for ${x}`);
const mod = generateFileBasedModuleName(shim);

I can submit a PR for that if someone can confirm my theory about what's going on, here. I haven't yet given Brunch explicit instructions on how to behave. It strikes me it's inhaling my server-side modules as if they're client side.

`fcache.updateCache` is called on a directory

.../web/client/node_modules/brunch/lib/fs_utils/file_list.js:198
        if (error) throw new Error(formatError('Reading', error));
                   ^

Error: undefined of Error: EISDIR: illegal operation on a directory, read failed. 
  at .../web/client/node_modules/brunch/lib/fs_utils/file_list.js:198:26
  at .../web/client/node_modules/fcache/index.js:19:23
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:389:12)

From going brunch 2.6.0 to 2.6.1, only meaningful change is updated deppack. As far as I see, #12 introduced this issue (no problem w/ 0.3.3).

Btw, thanks, rejuvenating brunch.

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

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"
}

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.