kk-webpack-base--config
Version:
Webpack config for kk-webpack-base
78 lines (76 loc) • 2 kB
JavaScript
const path = require('path');
const common = require('./webpack.common.js');
const { merge } = require('webpack-merge');
const { config } = require('./webpack.project-config.js');
module.exports = merge(common, {
mode: 'development',
devtool: 'eval-cheap-module-source-map',
stats: {
colors: true,
errorDetails: true,
children: false,
modules: false,
chunks: false,
chunkModules: false,
warnings: false, // Suppress warnings in development
},
optimization: {
emitOnErrors: true,
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,
},
devServer: {
static: {
directory: path.join(process.cwd(), `${config.publicPath}`),
publicPath: '/',
watch: true,
},
open: {
target: ['http://localhost:8080'],
app: {
name: process.platform === 'darwin' ? 'google chrome' : 'chrome',
},
},
client: {
logging: 'error', // Only show errors in client
overlay: {
errors: true,
warnings: false, // Don't show warnings in overlay
},
progress: true,
},
devMiddleware: {
writeToDisk: true,
stats: 'errors-only', // Only show errors in dev middleware
},
hot: true,
liveReload: false,
compress: true,
port: 8080,
host: 'localhost',
allowedHosts: 'all',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
},
historyApiFallback: {
rewrites: [
{ from: /^\/assets\//, to: '/assets/' },
{ from: /./, to: '/index.html' },
],
},
},
watchOptions: {
poll: config.watchOptionsPoll,
ignored: ['**/node_modules', '**/dist', '**/build'],
aggregateTimeout: 300,
},
cache: {
type: 'filesystem',
buildDependencies: {
config: [__filename],
},
},
});