-
Notifications
You must be signed in to change notification settings - Fork 1.2k
get is not a function at getPubsubRoute , getLibp2pOptions #3531
Comments
This is the same issue you were having with |
@achingbrain |
I removed the
But still get this error:
|
@achingbrain After asking in Gitter Webpack, in Discord Electron and in StackOverflow, getting no answer and no help, I asked help also in webpack's github page where the answer, as you can see, has been: Webpack people posted also this link: jprichardson/node-jsonfile#140 which says : "jsonfile is not for use in the browser; only in Node or Electron." Might be related to this problem? I'm here again, because I do not know how to fix the problem. |
Starting a new project with
If I click through the stack trace, eventually in
The error being thrown contains the stack trace that's printed out when I So
The upstream version supports ES2020 so likely would understand the Optional Catch Binding syntax. So your options are:
|
Thank you @achingbrain Alex for this thoughrough analysis. Despite of being outdated and being declared to be not that reliable by its author , as I read in a github thread which you showed me during our frequent "meetings" here for my problems, @marshallofsound/webpack-asset-relocator-loader is still included within electron-forge package. I see here: electron/forge#1643 that others having this kind of issues with asset relocator. But discovered that even after removing @marshallofsound/webpack-asset-relocator-loader I still have problems : https://github.com/webpack/webpack/issues I was actually thinking to stop using webpack, but, since the project I'm working on is not a small project, I still need a bundler to keep eveything . I'm going to report, linking to your good analysis, these findings in the webpack's github issue /question I opened yesterday, in the electron-forge's github page, and in discord's Electron forum, hoping that someone will come up in trying to solve the problem. I ask you if you can keep this issue open in order to be able to understand how to solve the problem. |
You could just use webpack for the renderer, and use normal js for the main process. Run IPFS on the main process and use IPC to send data back and forth. That way you wouldn't need run any node modules through webpack and most of your problems will go away. VSCode will give you type integration for modules that publish type definitions, so you get the type-safety of TypeScript with less verbose syntax.
No, this issue will remain closed. This is the js-IPFS repo, for discussing issues around js-IPFS, and the problem you have has nothing to do with js-IPFS. |
Commenting the main process webpack configuration in forge.config.js :
gives this error:
As far as I understand from the electron-forge docs: https://www.electronforge.io/config/plugins/webpack it's not envisaged skipping mainConfig: './webpack.main.config.js' . So should I stop using Electron-Forge all together? |
I currently have the exact same issue with a fresh Sapper (https://github.com/sveltejs/sapper-template-webpack) project:
Webpack config: const webpack = require('webpack');
const WebpackModules = require('webpack-modules');
const path = require('path');
const config = require('sapper/config/webpack.js');
const pkg = require('./package.json');
const appConfig = require('./config.json');
const mode = process.env.NODE_ENV;
const dev = mode === 'development';
const alias = { svelte: path.resolve('node_modules', 'svelte') };
const extensions = ['.mjs', '.js', '.json', '.svelte', '.html'];
const mainFields = ['svelte', 'module', 'browser', 'main'];
const fileLoaderRule = {
test: /\.(png|jpe?g|gif)$/i,
use: [
'file-loader',
]
};
module.exports = {
client: {
entry: config.client.entry(),
output: output,
resolve: { alias, extensions, mainFields },
module: {
rules: [
{
test: /\.(svelte|html)$/,
use: {
loader: 'svelte-loader-hot',
options: {
dev,
hydratable: true,
emitCss: false,
hotReload: true // pending https://github.com/sveltejs/svelte/issues/2377
}
}
},
fileLoaderRule
]
},
mode,
plugins: [
new webpack.DefinePlugin({
'process.browser': true,
'process.env.NODE_ENV': JSON.stringify(mode),
'process.env.CONFIG': JSON.stringify(appConfig),
}),
].filter(Boolean),
devtool: dev && 'inline-source-map'
},
server: {
entry: config.server.entry(),
output: config.server.output(),
target: 'node',
resolve: { alias, extensions, mainFields },
externals: Object.keys(pkg.dependencies).concat('encoding'),
module: {
rules: [
{
test: /\.(svelte|html)$/,
use: {
loader: 'svelte-loader-hot',
options: {
css: false,
generate: 'ssr',
hydratable: true,
dev,
emitCss: false
}
}
},
fileLoaderRule
]
},
mode,
plugins: [
new webpack.DefinePlugin({
'process.browser': false,
'process.env.NODE_ENV': JSON.stringify(mode),
'process.env.CONFIG': JSON.stringify(appConfig),
}),
new WebpackModules(),
],
performance: {
hints: false // it doesn't matter if server.js is large
}
},
serviceworker: {
entry: config.serviceworker.entry(),
output: config.serviceworker.output(),
mode
}
}; |
@raphael10-collab Is this issue resolved as I am facing the same issue while using webpack.or you have switched to any other alternate. |
Sorry for disturbing you again, but I get this error which seems to be related to ipfs:
This is tsconfig.json :
This is package.json :
/tools/webpack/webpack.main.js :
/tools/webpack/webpack.renderer.js :
/tools/webpack/webpack.helpers.js :
/tools/webpack/webpack.aliases.js :
/tools/webpack/webpack.plugins.js :
/tools/webpack/webpack.rules.js :
You can find the code here: https://github.com/raphael10-collab/IPFS-Forge
git clone -> yarn -> yarn start
The text was updated successfully, but these errors were encountered: