rsnext/packages/next/build/webpack/config/blocks/base.ts
Joe Haddad 9b6ea9d466 Refactor Webpack Configuration (#9651)
* WIP

* Move data experiment

* Do not throw away rules

* Remove test code

* Correct next data behavior

* Add support for async composing

* Remove unnecessary workaround

* Rename Field
2019-12-09 14:08:15 -06:00

25 lines
628 B
TypeScript

import curry from 'lodash.curry'
import { Configuration } from 'webpack'
import { ConfigurationContext } from '../utils'
export const base = curry(function base(
ctx: ConfigurationContext,
config: Configuration
) {
config.mode = ctx.isDevelopment ? 'development' : 'production'
config.name = ctx.isServer ? 'server' : 'client'
config.target = ctx.isServer ? 'node' : 'web'
config.devtool = ctx.isDevelopment
? 'cheap-module-source-map'
: ctx.isProduction
? false
: false
if (!config.module) {
config.module = { rules: [] }
}
config.module.strictExportPresence = true
return config
})