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:
- Created 4 years ago
- Reactions:1
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I will add this to the “known limitations” in the README file soon.
Closing now.
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.