Repro attempt for apollographql/federation#211
@apollo/gateway -> @apollo-server-lambda -> serverless-webpack
Expecting a single .js bundle that works when required from Node 12.x.
Getting a single .js bundle that contains some busted webpacky bits:
- requiring util (?)
- reading local .wasm files at runtime
npm install
npm run package
cd build
unzip lambda.zip
node -e "require('.').main()"
Should spit out a module resolution error, like:
Thrown:
Error: Cannot find module 'util'
If you poke node_modules/@apollo/query-planner-wasm/
, changing line 4:
const { TextDecoder } = require(String.raw`util`);
... replacing with:
const { TextDecoder } = require('util');
... and rebuild, unzip, run again, you get the desired error:
It seems like this package is bundled with wasm-pack -t nodejs
.
This use case might expect -t bundler
and some kind of .wasm$
webpack loader?