Giter VIP home page Giter VIP logo

Comments (6)

yoshuawuyts avatar yoshuawuyts commented on May 18, 2024 1

This is what it was intended like:

const bankai = require('bankai')

const assets = bankai(require.resolve('./client'), {
  html: { favicon: false },
  js: { debug: true },
  css: false
})

const js = assets.js
const html = assets.html

from bankai.

yoshuawuyts avatar yoshuawuyts commented on May 18, 2024 1

@bcomnes does this resolve it for you?

from bankai.

yoshuawuyts avatar yoshuawuyts commented on May 18, 2024 1

gonna assume this is no longer an issue (:

from bankai.

bcomnes avatar bcomnes commented on May 18, 2024

The example here does yeah. I still think the read me or some kind of example should include this info though so its discoverable. I can PR some suggestions when I have time to work on projects using the lib again.

from bankai.

bcomnes avatar bcomnes commented on May 18, 2024

Ok this is a weird one:

const bankai = require('bankai')

const assets = bankai(require.resolve('./client'), {
  html: { favicon: false },
  js: { debug: true },
  css: false
})


const js = assets.js
const html = assets.html

http.createServer((req, res) => {
  switch (req.url) {
    case '/': return html(req, res).pipe(res)
    case '/bundle.js': return js(req, res).pipe(res)
    default: return (res.statusCode = 404 && res.end('404 not found'))
  }
}).listen(8080)

Does not work:

TypeError: this._createJs is not a function
   at Bankai.js (/Users/bret/repos/hyperblog/node_modules/bankai/index.js:44:8)
   at RouteResult.handler (/Users/bret/repos/hyperblog/index.js:46:8)
   at Hyperserv.handleRequest [as router] (/Users/bret/repos/hyperblog/node_modules/@bret/http-hash-router/index.js:68:22)
   at routeReq (/Users/bret/repos/hyperblog/node_modules/hyperserv/index.js:37:14)
   at Hyperserv.logger (/Users/bret/repos/hyperblog/node_modules/morgan/index.js:144:5)
   at Server.onReq (/Users/bret/repos/hyperblog/node_modules/hyperserv/index.js:32:10)
   at emitTwo (events.js:106:13)
   at Server.emit (events.js:191:7)
   at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:547:12)
   at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

But this does:

const bankai = require('bankai')

const assets = bankai(require.resolve('./client'), {
  html: { favicon: false },
  js: { debug: true },
  css: false
})

http.createServer((req, res) => {
  switch (req.url) {
    case '/': return assets.html(req, res).pipe(res)
    case '/bundle.js': return assets.js(req, res).pipe(res)
    default: return (res.statusCode = 404 && res.end('404 not found'))
  }
}).listen(8080)

does work! So somehow, assigning .html and .js to variables makes them not work in the request handler.

Scratching my head at where I might have missed something obvious. Any ideas? Here is the repo I'm screwing around on:

https://github.com/bcomnes/hyperblog/blob/greenkeeper-bankai-5.0.0/index.js#L24

from bankai.

yoshuawuyts avatar yoshuawuyts commented on May 18, 2024

Landed v5.1.0 - could you give this another shot?

from bankai.

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.