question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fail test - bytenode, ncc, fastify ?

See original GitHub issue
#!/usr/bin/env bash

export __TEST_DIR__="bytenode-ncc-fastify-test"

mkdir $__TEST_DIR__
cd $__TEST_DIR__

npm init --yes
npm i fastify -E
npm i bytenode @zeit/ncc -E -D

touch index.js

read -r -d '' INDEX_JS << EOF
  'use strict';
  const build = require('fastify');
  const server = build({ logger: true });
  server.all('/', async () => ({ ok: 'ok' }));
  (async () => await server.listen())();
EOF

echo $INDEX_JS > index.js

npx @zeit/ncc build index.js --out dist
npx bytenode --compile dist/index.js

# this should run?
# but it does not...
# npx bytenode $__TEST_DIR__/dist/index.jsc
npx bytenode dist/index.jsc

# Error =>
# undefined:6
#     ?
#
# SyntaxError: Invalid or unexpected token
#     at Function (<anonymous>)
#     at build (evalmachine.<anonymous>:1:70996)
#     at Object.560 (evalmachine.<anonymous>:1:521710)
#     at __webpack_require__ (evalmachine.<anonymous>:1:769)
#     at Object.360 (evalmachine.<anonymous>:1:395429)
#     at __webpack_require__ (evalmachine.<anonymous>:1:769)
#     at Object.104 (evalmachine.<anonymous>:1:66439)
#     at __webpack_require__ (evalmachine.<anonymous>:1:769)
#     at startup (evalmachine.<anonymous>:1:1228)
#     at evalmachine.<anonymous>:1:1390


#### this however runs ok
####
#### node dist/index.js
#### node $__TEST_DIR__/dist/index.js
#### node ./bytenode-ncc-fastify-test/dist/index.js

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
OsamaAbbascommented, Oct 1, 2019

I will add this to the “known limitations” in the README file soon.

Closing now.

0reactions
Nihiuecommented, Mar 26, 2021

I got the same issue, some web framework dynamically loads its components, and uses toString to judge whether a class is loaded, which requires operator new to init.

see: https://github.com/miguelmota/is-class/blob/master/is-class.js#L13

I am digging into v8 to find some workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

fail test - bytenode, ncc, fastify ? · Issue #34 - GitHub
So, this might be the cause of the issue. I have not figured out the exact reason why it does not play nice...
Read more >
Testing - Fastify
Testing is one of the most important parts of developing an application. Fastify is very flexible when it comes to testing and is...
Read more >
Node.js | Everything I know - My Knowledge Wiki
TestCafe - Node.js tool to automate end-to-end web testing. ndb - Improved debugging ... Fastify - Fast and low overhead web framework, for...
Read more >
bike - npm Package Health Analysis - Snyk
Unable to detect license. We couldn't find an appropriate license for this project. It is highly advised to make sure the project license...
Read more >
How to Compile Node.js Code Using Bytenode? - Medium
Check bytenode repository on Github. ... But this will fail, V8 engine will complain about the first argument (that empty string '' ) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found