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

Function baseConfig

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

142 * Default: umd
143 */
144function baseConfig({ target = isProduction ? 'umd' : 'umddir' } = {}) {
145 return {
146 context: process.cwd(),
147 mode: isProduction ? 'production' : 'development',
148 entry: './src',
149 output: targetOutputs()[target],
150 module: {
151 rules: flatMap(Object.values(rules()), rule => rule()),
152 },
153 resolve: {
154 extensions: ['.ts', '.tsx', '.js', '.json'],
155 fallback: {
156 stream: require.resolve('stream-browserify'),
157 url: require.resolve('url/'),
158 process: require.resolve('process/browser'),
159 },
160 alias: {
161 url: require.resolve('url/'),
162 'process/browser': require.resolve('process/browser'),
163 // Polyfill for fileURLToPath used by clean-stack
164 'node:url': require.resolve('url/'),
165 },
166 },
167 plugins: Object.values(plugins()).map(plugin => plugin()),
168 devtool: isTest ? '' : 'source-map',
169 target: 'web',
170
171 /**
172 * Exclude peer dependencies from package bundles.
173 */
174 externals:
175 target.slice(0, 3) === 'umd'
176 ? umdExternals
177 : (context, request, cb) => {
178 const externals = Object.keys(pkg.peerDependencies || {});
179
180 function isPeerDep(dep) {
181 return new RegExp(`^${dep}($|/)`).test(request);
182 }
183
184 return externals.some(isPeerDep) ? cb(null, request) : cb();
185 },
186 stats: stats(),
187 };
188}
189
190function getConfig({ baseOnly = false } = {}) {
191 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