Issue in webpack configuration
raphael10-collab opened this issue · 0 comments
raphael10-collab commented
Explain the problem
Expected Behaviour
Actual Behaviour
Steps to reproduce
Provide your webpack config
Provide your Environment details
-
Node version:
-
Operating System:
-
webpack version:
-
parallel-webpack version:
With this webpack.renderer.js :
/* eslint-disable @typescript-eslint/no-var-requires */
const rules = require('./webpack.rules');
const plugins = require('./webpack.plugins');
const aliases = require('./webpack.aliases');
module.exports = {
// https://github.com/electron/electron/issues/9920
//target: 'electron-renderer',
target: 'web',
module: {
rules,
},
plugins: plugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'],
alias: {
// React Hot Loader Patch
'react-dom': '@hot-loader/react-dom',
// Custom Aliases
...aliases,
},
},
};
The electron app works fine:
Now, since I need multiple configurations, based on the example: https://github.com/trivago/parallel-webpack#variants-example ,
I tried to use parallel-webpack in this way:
/* eslint-disable @typescript-eslint/no-var-requires */
const rules = require('./webpack.rules');
const plugins = require('./webpack.plugins');
const aliases = require('./webpack.aliases');
// https://webpack.js.org/concepts/targets/#multiple-targets
// https://github.com/trivago/parallel-webpack#variants-example
var createVariants = require('parallel-webpack').createVariants;
var baseOptions = {
preferredRules: rules,
preferredPlugins: plugins,
preferredExtensions: ['.js', '.ts', '.jsx', '.tsx', '.css'],
preferredAliases: aliases
};
var variants = {
target: ['electron-renderer', 'electron-main', 'web']
};
function createConfig(options) {
return {
target: options.target,
module: {
rules: preferredRules,
},
plugins: preferredPlugins,
resolve: {
extensions: preferredExtensions,
alias: {
// React Hot Loader Patch
'react-dom': '@hot-loader/react-dom',
// Custom Aliases
...preferredAliases,
}
}
}
}
But I get this error:
devDependencies:
"node-loader": "^1.0.1",
"parallel-webpack": "^2.6.0",
"electron": "^11.2.1",
"typescript": "^4.0.2",
"webpack": "4"
OS: Ubuntu 18.04.4 Desktop
node: v14.5.0
Here I've put the simple repo, so you can check yourself and easily spot the problem: https://github.com/raphael10-collab/OnlyLibp2p
Just git clone it ----> yarn ---> yarn start
How to solve the problem?