-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1395 from flexn-io/fix/webpack_merge
fix/webpack_merge
- Loading branch information
Showing
13 changed files
with
90 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const webpack = require('webpack'); //to access built-in plugins | ||
|
||
const { withRNV } = require('@rnv/engine-rn-web'); | ||
|
||
module.exports = withRNV({ | ||
resolve: { | ||
alias: { | ||
'my-module': 'some_path', | ||
}, | ||
modules: ['test_modules'], | ||
}, | ||
plugins: [new webpack.ProgressPlugin()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import path from 'path'; | ||
import { Configuration } from 'webpack'; | ||
|
||
import { mergeWithCustomize, unique, merge } from 'webpack-merge'; | ||
|
||
export const withRNVWebpack = (cnf: Configuration) => { | ||
//TODO: implement further overrides | ||
const rnvConfig: Configuration = {}; | ||
const config = merge(rnvConfig, cnf); | ||
return config; | ||
}; | ||
|
||
export const getMergedConfig = (rootConfig: Configuration, appPath: string) => { | ||
// RNV-ADDITION | ||
|
||
const projectConfig = require(path.join(appPath, 'webpack.config')); | ||
const rootPlugins = rootConfig.plugins?.map((plugin) => plugin?.constructor.name) as string[]; | ||
|
||
const mergedConfig: Configuration = mergeWithCustomize({ | ||
customizeArray: unique('plugins', rootPlugins, (plugin) => plugin.constructor && plugin.constructor.name), | ||
})(rootConfig, projectConfig); | ||
|
||
// Merge => static config, adapter config , project config | ||
// RNV-ADDITION | ||
|
||
return mergedConfig; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { withRNV } = require('@rnv/engine-rn-web'); | ||
|
||
module.exports = withRNV({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters