mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
simplify webpack config
This commit is contained in:
parent
e467007f94
commit
cd362f6feb
@ -40,9 +40,6 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
const config = {
|
||||
name,
|
||||
mode: this.options.dev ? 'development' : 'production',
|
||||
entry: {
|
||||
app: null
|
||||
},
|
||||
optimization: {},
|
||||
output: {
|
||||
path: resolve(this.options.buildDir, 'dist'),
|
||||
@ -53,8 +50,6 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
: urlJoin(this.options.router.base, this.options.build.publicPath)
|
||||
},
|
||||
performance: {
|
||||
maxEntrypointSize: 1000000,
|
||||
maxAssetSize: 300000,
|
||||
hints: this.options.dev ? false : 'warning'
|
||||
},
|
||||
resolve: {
|
||||
|
@ -17,7 +17,7 @@ module.exports = function webpackClientConfig() {
|
||||
let config = base.call(this, { name: 'client', isServer: false })
|
||||
|
||||
// Entry points
|
||||
config.entry.app = resolve(this.options.buildDir, 'client.js')
|
||||
config.entry = resolve(this.options.buildDir, 'client.js')
|
||||
|
||||
// Env object defined in nuxt.config.js
|
||||
let env = {}
|
||||
@ -80,25 +80,23 @@ module.exports = function webpackClientConfig() {
|
||||
)
|
||||
|
||||
// Optimization
|
||||
config.optimization = {
|
||||
splitChunks: {
|
||||
config.optimization.splitChunks = {
|
||||
chunks: 'all',
|
||||
// TODO: remove spa after https://github.com/jantimon/html-webpack-plugin/issues/878 solved
|
||||
name: this.options.dev || this.options.mode === 'spa'
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------
|
||||
// Dev specific config
|
||||
// --------------------------------------
|
||||
if (this.options.dev) {
|
||||
// Add HMR support
|
||||
config.entry.app = [
|
||||
config.entry = [
|
||||
// https://github.com/glenjamin/webpack-hot-middleware#config
|
||||
`webpack-hot-middleware/client?name=client&reload=true&timeout=30000&path=${
|
||||
this.options.router.base
|
||||
}/__webpack_hmr`.replace(/\/\//g, '/'),
|
||||
config.entry.app
|
||||
config.entry
|
||||
]
|
||||
|
||||
// HMR
|
||||
|
Loading…
Reference in New Issue
Block a user