kitajchuk / hobo

A very small, modular DOM utility for modern web apps.
MIT License
13 stars 2 forks source link

eq is not a function #12

Open calebmichaelsanchez opened 6 years ago

calebmichaelsanchez commented 6 years ago

I've done my best to get things running as you describe them in the docs, but I'm having trouble getting to the extended functions.

I've added a postinstall script into the package.json and ran it, but for some reason it doesn't want to work.

Any suggestions?

edit: I don't know if the build function is just not working as expected, but I ended up opening the hobo.js file myself and adding this Hobo.prototype.eq = require("./lib/extended/eq");

That seemed to do the trick!

kitajchuk commented 6 years ago

Seems like maybe your postinstall script may be missing eq? If you can show me a working example of what you have I can probably debug faster :)

calebmichaelsanchez commented 6 years ago

"postinstall": "cd ./node_modules/properjs-hobo && npm install && npm run build -- 'is eq not attr filter detach remove append closest'"

This was the output, sorry for the length.

> rm -rf dist/* && node build.js "is eq not attr filter detach remove append closest"

> [Hobo] Generated custom build with -- is eq not attr filter detach remove append closest

> properjs-hobo@0.3.18 postbuild /Users/calebsanchez/Sites/southlandchurch.org/node_modules/properjs-hobo
> webpack --progress --profile --display-modules --colors && rm -rf docs/* && npm run doc && npm run min

196ms building modules                                                      l 4ms sealing 
0ms optimizing 
0ms basic module optimization 
1ms module optimization 
1ms advanced module optimization 
0ms basic chunk optimization 
0ms chunk optimization 
0ms advanced chunk optimization 
1ms module and chunk tree optimization 
0ms chunk modules optimization 
0ms advanced chunk modules optimization 
2ms module reviving 
0ms module order optimization 
2ms module id optimization 
1ms chunk reviving 
1ms chunk order optimization 
2ms chunk id optimization 
3ms hashing 
0ms module assets processing 
10ms chunk assets processing
1ms additional chunk assets processing 
0ms recording 
1ms additional asset processing 
0ms chunk asset optimization 
1ms asset optimization 
9ms emitting 
Hash: a698b4759c406473b3fd
Version: webpack 3.10.0
Time: 288ms
             Asset     Size  Chunks             Chunk Names
hobo.build.dist.js  39.6 kB       0  [emitted]  hobo.build.dist
      hobo.dist.js  32.3 kB       1  [emitted]  hobo.dist
   [0] ./lib/utils.js 7.96 kB {0} {1} [built]
       [] -> factory:25ms building:34ms = 59ms
   [1] ./lib/Hobo.js 3.34 kB {0} {1} [built]
       [] -> factory:25ms building:22ms dependencies:1ms = 48ms
   [2] ./node_modules/properjs-matchelement/matchElement.js 1.75 kB {0} {1} [built]
       [] -> factory:51ms building:3ms = 54ms
   [3] (webpack)/buildin/global.js 509 bytes {0} {1} [built]
       [] -> factory:76ms building:18ms = 94ms
   [4] ./lib/core/on.js 2.71 kB {0} {1} [built]
       [] -> factory:26ms building:38ms dependencies:2ms = 66ms
   [5] ./lib/core/off.js 2.94 kB {0} {1} [built]
       [] -> factory:27ms building:42ms = 69ms
   [6] ./lib/core/data.js 1.43 kB {0} {1} [built]
       [] -> factory:27ms building:44ms dependencies:0ms = 71ms
   [7] ./lib/core/find.js 942 bytes {0} {1} [built]
       [] -> factory:28ms building:45ms dependencies:1ms = 74ms
   [8] ./lib/core/addClass.js 698 bytes {0} {1} [built]
       [] -> factory:28ms building:48ms dependencies:0ms = 76ms
   [9] ./lib/core/removeClass.js 1.04 kB {0} {1} [built]
       [] -> factory:29ms building:49ms dependencies:0ms = 78ms
  [10] ./lib/core/ajax.js 3.58 kB {0} {1} [built]
       [] -> factory:29ms building:54ms dependencies:1ms = 84ms
  [11] ./dist/hobo.build.js-exposed 63 bytes {0} [built]
        factory:67ms building:2ms dependencies:66ms = 135ms
  [12] ./dist/hobo.build.js 2.48 kB {0} [built]
       [] -> factory:2ms building:53ms dependencies:20ms = 75ms
  [13] ./lib/extended/is.js 404 bytes {0} [built]
       [] -> factory:21ms building:58ms dependencies:27ms = 106ms
  [14] ./lib/extended/eq.js 403 bytes {0} [built]
       [] -> factory:29ms building:63ms dependencies:1ms = 93ms
  [15] ./lib/extended/not.js 1.15 kB {0} [built]
       [] -> factory:21ms building:64ms dependencies:21ms = 106ms
  [16] ./lib/extended/attr.js 1.39 kB {0} [built]
       [] -> factory:21ms building:56ms dependencies:1ms = 78ms
  [17] ./lib/extended/filter.js 549 bytes {0} [built]
       [] -> factory:22ms building:59ms dependencies:25ms = 106ms
  [18] ./lib/extended/detach.js 376 bytes {0} [built]
       [] -> factory:22ms building:67ms = 89ms
  [19] ./lib/extended/remove.js 505 bytes {0} [built]
       [] -> factory:22ms building:65ms = 87ms
  [20] ./lib/extended/append.js 946 bytes {0} [built]
       [] -> factory:23ms building:68ms dependencies:0ms = 91ms
  [21] ./lib/extended/closest.js 575 bytes {0} [built]
       [] -> factory:23ms building:65ms dependencies:19ms = 107ms
  [22] ./hobo.js-exposed 57 bytes {1} [built]
        factory:32ms building:19ms = 51ms
  [23] ./hobo.js 1.87 kB {1} [built]
       [] -> factory:12ms building:45ms = 57ms

> properjs-hobo@0.3.18 doc /Users/calebsanchez/Sites/southlandchurch.org/node_modules/properjs-hobo
> jsdoc dist/hobo.build.dist.js -R README.md -P package.json -t node_modules/jsdoc-oblivion/template -c node_modules/jsdoc-oblivion/template/jsdoc.conf.json -d docs

> properjs-hobo@0.3.18 min /Users/calebsanchez/Sites/southlandchurch.org/node_modules/properjs-hobo
> uglifyjs dist/hobo.build.dist.js -c warnings=false -m -o dist/hobo.build.dist.min.js && uglifyjs dist/hobo.dist.js -c warnings=false -m -o dist/hobo.dist.min.js
kitajchuk commented 6 years ago

Ok. So ProperJS/app is a working model. I think you might not have the hobo key added to your webpack mainFields. Here's the link directly to that webpack file:

https://github.com/ProperJS/app/blob/master/webpack.config.js.

You'll notice it has this, ensuring hobo is one of the lookups before main:

resolve: {
    modules: [root, source, nodeModules],
    mainFields: ["webpack", "browserify", "web", "hobo", "main"]
}

This allows webpack to pull from the hobo field in its package.json rather than the main field:

"main": "hobo",
"hobo": "dist/hobo.build"

Let me know if that helps :)

calebmichaelsanchez commented 6 years ago

I saw that as I was browsing around the repos. I will add it and report back!