MCPcopy Create free account
hub / github.com/decaporg/decap-cms / baseConfig

Function baseConfig

scripts/webpack.js:131–165  ·  view source on GitHub ↗

* Use [getConfig({ target:'umd' }), getConfig({ target:'cjs' })] for * getting multiple configs and add the new output in targetOutputs if needed. * Default: umd

({ target = isProduction ? 'umd' : 'umddir' } = {})

Source from the content-addressed store, hash-verified

129 * Default: umd
130 */
131function baseConfig({ target = isProduction ? 'umd' : 'umddir' } = {}) {
132 return {
133 context: process.cwd(),
134 mode: isProduction ? 'production' : 'development',
135 entry: './src',
136 output: targetOutputs()[target],
137 module: {
138 rules: flatMap(Object.values(rules()), rule => rule()),
139 },
140 resolve: {
141 extensions: ['.ts', '.tsx', '.js', '.json'],
142 fallback: { stream: require.resolve('stream-browserify') },
143 },
144 plugins: Object.values(plugins()).map(plugin => plugin()),
145 devtool: isTest ? '' : 'source-map',
146 target: 'web',
147
148 /**
149 * Exclude peer dependencies from package bundles.
150 */
151 externals:
152 target.slice(0, 3) === 'umd'
153 ? umdExternals
154 : (context, request, cb) => {
155 const externals = Object.keys(pkg.peerDependencies || {});
156
157 function isPeerDep(dep) {
158 return new RegExp(`^${dep}($|/)`).test(request);
159 }
160
161 return externals.some(isPeerDep) ? cb(null, request) : cb();
162 },
163 stats: stats(),
164 };
165}
166
167function getConfig({ baseOnly = false } = {}) {
168 if (baseOnly) {

Callers 1

getConfigFunction · 0.85

Calls 6

targetOutputsFunction · 0.85
rulesFunction · 0.85
statsFunction · 0.85
mapMethod · 0.80
someMethod · 0.80
pluginsFunction · 0.70

Tested by

no test coverage detected