Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
output: configCustom.getOutput(),
module: configCustom.getModule(),
resolve: configCustom.getResolve(),
externals: configCustom.getExternals(),
plugins: configCustom.getPlugins(),
};
var otherConfig = configCustom.getOtherOptions();
for (let key in otherConfig) {
userConfig[key] = otherConfig[key];
}
baseConfig = configWebpackMerge.mergeProcess(baseConfig);
var webpackConfig = webpackMerge.smartStrategy(
configWebpackMerge.smartStrategyOption
)(baseConfig, userConfig);
// console.log(JSON.stringify(webpackConfig, null, 4));
module.exports = webpackConfig;
resolve: configCustom.getResolve(),
externals: configCustom.getExternals(),
plugins: configCustom.getPlugins()
};
let otherConfig = configCustom.getOtherOptions();
for (let key in otherConfig) {
if (otherConfig.hasOwnProperty(key)) {
userConfig[key] = otherConfig[key];
}
}
baseConfig = configWebpackMerge.mergeProcess(baseConfig);
let webpackConfig = webpackMerge.smartStrategy(
configWebpackMerge.smartStrategyOption
)(baseConfig, userConfig);
// console.log(JSON.stringify(webpackConfig, null, 4));
module.exports = webpackConfig;
module.exports = function createConfig (...configs) {
let {
target = 'web',
...config
} = merge.smartStrategy({'module.rules': 'prepend'})(...configs)
const envTarget = target === 'node' ? {"node": "current"} : {"browsers": "defaults"}
const mainFields =
target === 'web'
? ['browser', 'jsnext', 'esnext', 'jsnext:main', 'main']
: ['jsnext', 'esnext', 'jsnext:main', 'main']
return merge.smartStrategy({'module.rules': 'prepend'})(
{
devtool: process.env.NODE_ENV !== 'production' ? 'eval' : false,
target,
// The base directory for resolving the entry option
output: {
publicPath: '/public/',
pathinfo: true
},
// Where to resolve our loaders
resolveLoader: {
modules: ['node_modules'],
moduleExtensions: ['-loader'],
},
function mergeWithOptions(options, configs, current) {
// merge with the previous configs using the provided strategy
if (options.strategy) {
return options.smart
? merge.smartStrategy(options.strategy)(...configs, current)
: merge.strategy(options.strategy)(...configs, current)
} else {
return options.smart
? merge.smart(...configs, current)
: merge(...configs, current)
}
}
module.exports = env => {
const { ifProduction, ifDevelopment } = getIfUtils(env);
const config = merge.smartStrategy(plConfig.app.webpackMerge)(
{
devtool: ifDevelopment("source-map"),
context: resolve(__dirname, plConfig.paths.source.root),
node: {
fs: "empty"
},
entry: {
// Gathers any Source JS files and creates a bundle
//NOTE: This name can be changed, if so, make sure to update _meta/01-foot.mustache
"js/pl-source": globby
.sync([
resolve(__dirname, `${plConfig.paths.source.js}**/*.js`),
"!**/*.test.js"
])
.map(function(filePath) {
return filePath;
public mergeWithStrategy(strategy: any, config: any, overrides: any): Configuration {
return merge.smartStrategy(strategy)(config, overrides);
}
}
public mergeWithStrategy(strategy: any, config: any, overrides: any): Configuration {
return merge.smartStrategy(strategy)(config, overrides);
}
}
export default function createCompiler(percyConfig) {
const config = merge.smartStrategy({
'module.rules': 'prepend',
plugins: 'prepend',
})(percyConfig.webpack, {
bail: true,
context: percyConfig.rootDir,
devtool: percyConfig.webpack.devtool || '#cheap-module-source-map',
entry: getEntry(percyConfig),
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: require.resolve('babel-loader'),
query: babelConfig,
exclude: /node_modules/,
},
],