Can`t change webpackConfig file in Theia extension browser-app module

I want to add some webpack plugin in browser-app webpack config?
If, I run “theia build” The modification has removed automatically.
It would be highly appreciated if you could help me on this issue.

[original thread by Madasamy]

Hi @madasamy, you can provide an alternative webpack configuraiton using -c option for theia, i.e. theia start -c mywepback-config.js

Since webpack config exports js object, your configuration can import the generated configuration, mutate it and reexport. As it is done here for example: https://github.com/eclipse-theia/theia/issues/766#issuecomment-341720642

[Madasamy]

Thanks @anton-kosyakov, I will try with that approach.

[Madasamy]

Its Showing error “: webpack exited with an unexpected code: 1.
at ChildProcess. (path\node_modules@theia\application-manager\lib\appl”

[Madasamy]

I am using command “theia build -c my-webpack,config.js”

yes, it should work like that

do you have any other errors?

is there a way to see your webpack config?

[Madasamy]

Yes, const genConfig = require(’./webpack.config.js’)
const merge = require(‘webpack-merge’);
const perpspectivePath = ‘path/node_modules/@omega/perspective/dist’;

module.exports = merge.smart({

plugins: [
new CopyPlugin([
{ from: perpspectivePath, to: ‘ms-monorepo’ }
]),
],
}, genConfig);

[Madasamy]

It showing error as “Unknown argument: c”

try –config

[Madasamy]

–config is working now

strange -c supposed to be an alias for –config. Anyway glad it works for you.

[Madasamy]

Thanks @anton-kosyakov