How to use/bundle the web3 package correctly?
See original GitHub issueThis is a Bug Report
Description
For bug reports:
- What went wrong?
Stuck on packaging after running
serverless webpack
for a very long time > 10 minutes. - What did you expect should have happened? Packaged sooner than that.
- What was the config you used?
// webpack.config.js
var path = require('path')
const slsw = require('serverless-webpack')
var nodeExternals = require('webpack-node-externals')
var entries = slsw.lib.entries
const models = [
'./models/charge.model.js',
'./models/metrics.model.js',
'./models/user.model.js'
]
for (let i in models) {
entries[models[i]] = models[i]
}
module.exports = {
entry: entries,
target: 'node',
// Generate sourcemaps for proper error messages
devtool: 'eval',
// Since 'aws-sdk' is not compatible with webpack,
// we exclude all node dependencies
externals: [nodeExternals()],
// Run babel on all .js files and skip those in node_modules
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
include: __dirname,
exclude: /node_modules/
}
]
},
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
}
}
-
What stacktrace or error message from your provider did you see? This is the message it is stuck on:
Serverless: Packing external modules: babel-runtime@^6.25.0, sequelize@^4.8.3, nodemailer@^4.0.1, hat@0.0.3, promise@^8.0.1, web3@^1.0.0-beta.18, truffle-contract@^3.0.0, basic-auth@^2.0.0
-
Serverless-Webpack Version you’re using: 3.0.0
-
Webpack version you’re using: 3.5.6
-
Serverless Framework Version you’re using: 1.22.0
-
Operating System: macOS 10.12.6
Issue Analytics
- State:
- Created 6 years ago
- Comments:52 (25 by maintainers)
Top Results From Across the Web
web3js later versions. Bundle, how? - Ethereum Stack Exchange
I'm trying to build the frontend of a dApp, but the web3js makes my head hurt. I need to include it in my...
Read more >Getting Started — web3.js 1.0.0 documentation
The web3.js library is a collection of modules that contain functionality for the ethereum ... web3-eth is for the ethereum blockchain and smart...
Read more >very fast airplane crossword clue
I am trying to use the pinyin package for glossing Chinese text. ... The clue can narrow your options down to the correct...
Read more >Using the Ethereum Web3 Library to Send Transactions on ...
The Web3 JavaScript library is one of the many ways we can interact with ... installed correctly by querying the version for each...
Read more >Set up web3.js to use the Ethereum blockchain in JavaScript
To test that we correctly configured our Web3 instance, we'll try to retrieve the latest block number using the getBlockNumber function.
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 Free
Top 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
Contents of
nodeModules
:Looks like the right stuff is in there. I’ll try with the latest PR. I might not get to it today, but I’ll update when I find out more.
Verification is quite easy: Run
serverless package
and check the zip files created in.serverless
if they contain the modules.For the config … I’ll try to come up with a solution after reading the thread.