mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +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 = {
|
const config = {
|
||||||
name,
|
name,
|
||||||
mode: this.options.dev ? 'development' : 'production',
|
mode: this.options.dev ? 'development' : 'production',
|
||||||
entry: {
|
|
||||||
app: null
|
|
||||||
},
|
|
||||||
optimization: {},
|
optimization: {},
|
||||||
output: {
|
output: {
|
||||||
path: resolve(this.options.buildDir, 'dist'),
|
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)
|
: urlJoin(this.options.router.base, this.options.build.publicPath)
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
||||||
maxEntrypointSize: 1000000,
|
|
||||||
maxAssetSize: 300000,
|
|
||||||
hints: this.options.dev ? false : 'warning'
|
hints: this.options.dev ? false : 'warning'
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
@ -17,7 +17,7 @@ module.exports = function webpackClientConfig() {
|
|||||||
let config = base.call(this, { name: 'client', isServer: false })
|
let config = base.call(this, { name: 'client', isServer: false })
|
||||||
|
|
||||||
// Entry points
|
// 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
|
// Env object defined in nuxt.config.js
|
||||||
let env = {}
|
let env = {}
|
||||||
@ -80,12 +80,10 @@ module.exports = function webpackClientConfig() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Optimization
|
// Optimization
|
||||||
config.optimization = {
|
config.optimization.splitChunks = {
|
||||||
splitChunks: {
|
chunks: 'all',
|
||||||
chunks: 'all',
|
// TODO: remove spa after https://github.com/jantimon/html-webpack-plugin/issues/878 solved
|
||||||
// TODO: remove spa after https://github.com/jantimon/html-webpack-plugin/issues/878 solved
|
name: this.options.dev || this.options.mode === 'spa'
|
||||||
name: this.options.dev || this.options.mode === 'spa'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
@ -93,12 +91,12 @@ module.exports = function webpackClientConfig() {
|
|||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
if (this.options.dev) {
|
if (this.options.dev) {
|
||||||
// Add HMR support
|
// Add HMR support
|
||||||
config.entry.app = [
|
config.entry = [
|
||||||
// https://github.com/glenjamin/webpack-hot-middleware#config
|
// https://github.com/glenjamin/webpack-hot-middleware#config
|
||||||
`webpack-hot-middleware/client?name=client&reload=true&timeout=30000&path=${
|
`webpack-hot-middleware/client?name=client&reload=true&timeout=30000&path=${
|
||||||
this.options.router.base
|
this.options.router.base
|
||||||
}/__webpack_hmr`.replace(/\/\//g, '/'),
|
}/__webpack_hmr`.replace(/\/\//g, '/'),
|
||||||
config.entry.app
|
config.entry
|
||||||
]
|
]
|
||||||
|
|
||||||
// HMR
|
// HMR
|
||||||
|
Loading…
Reference in New Issue
Block a user