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

Function baseConfig

scripts/webpack.js:135–169  ·  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

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