mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
use webpack's built in minimizer
This commit is contained in:
parent
19e802e4f2
commit
76b5e0454a
@ -69,7 +69,6 @@ if (options.mode !== 'spa') {
|
|||||||
// -- Build for SSR app --
|
// -- Build for SSR app --
|
||||||
builder
|
builder
|
||||||
.build()
|
.build()
|
||||||
.then(() => console.error('Building done'))
|
|
||||||
.then(() => close())
|
.then(() => close())
|
||||||
.catch(Utils.fatalError)
|
.catch(Utils.fatalError)
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,6 +43,7 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
|||||||
entry: {
|
entry: {
|
||||||
app: null
|
app: null
|
||||||
},
|
},
|
||||||
|
optimization: {},
|
||||||
output: {
|
output: {
|
||||||
path: resolve(this.options.buildDir, 'dist'),
|
path: resolve(this.options.buildDir, 'dist'),
|
||||||
filename: this.getFileName('app'),
|
filename: this.getFileName('app'),
|
||||||
|
@ -3,7 +3,6 @@ const webpack = require('webpack')
|
|||||||
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
|
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
|
||||||
const HTMLPlugin = require('html-webpack-plugin')
|
const HTMLPlugin = require('html-webpack-plugin')
|
||||||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
|
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
|
||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
|
|
||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||||
const { resolve } = require('path')
|
const { resolve } = require('path')
|
||||||
const Debug = require('debug')
|
const Debug = require('debug')
|
||||||
@ -118,34 +117,6 @@ module.exports = function webpackClientConfig() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webpack.js.org/plugins/hashed-module-ids-plugin
|
|
||||||
config.plugins.push(new webpack.HashedModuleIdsPlugin())
|
|
||||||
|
|
||||||
// Minify JS
|
|
||||||
// https://github.com/webpack-contrib/uglifyjs-webpack-plugin
|
|
||||||
if (this.options.build.uglify !== false) {
|
|
||||||
config.plugins.push(
|
|
||||||
new UglifyJSPlugin(
|
|
||||||
Object.assign(
|
|
||||||
{
|
|
||||||
cache: true,
|
|
||||||
sourceMap: true,
|
|
||||||
parallel: true,
|
|
||||||
extractComments: {
|
|
||||||
filename: 'LICENSES'
|
|
||||||
},
|
|
||||||
uglifyOptions: {
|
|
||||||
output: {
|
|
||||||
comments: /^\**!|@preserve|@license|@cc_on/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
this.options.build.uglify
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Webpack Bundle Analyzer
|
// Webpack Bundle Analyzer
|
||||||
if (this.options.build.analyze) {
|
if (this.options.build.analyze) {
|
||||||
config.plugins.push(
|
config.plugins.push(
|
||||||
|
@ -104,7 +104,6 @@
|
|||||||
"source-map": "^0.7.2",
|
"source-map": "^0.7.2",
|
||||||
"style-resources-loader": "^1.1.0",
|
"style-resources-loader": "^1.1.0",
|
||||||
"time-fix-plugin": "^2.0.0",
|
"time-fix-plugin": "^2.0.0",
|
||||||
"uglifyjs-webpack-plugin": "^1.2.3",
|
|
||||||
"upath": "^1.0.2",
|
"upath": "^1.0.2",
|
||||||
"url-loader": "^1.0.1",
|
"url-loader": "^1.0.1",
|
||||||
"vue": "^2.5.15",
|
"vue": "^2.5.15",
|
||||||
@ -118,7 +117,8 @@
|
|||||||
"webpack-bundle-analyzer": "^2.11.1",
|
"webpack-bundle-analyzer": "^2.11.1",
|
||||||
"webpack-dev-middleware": "^3.0.1",
|
"webpack-dev-middleware": "^3.0.1",
|
||||||
"webpack-hot-middleware": "^2.21.2",
|
"webpack-hot-middleware": "^2.21.2",
|
||||||
"webpack-node-externals": "^1.6.0"
|
"webpack-node-externals": "^1.6.0",
|
||||||
|
"webpack-stylish": "^0.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^0.25.0",
|
"ava": "^0.25.0",
|
||||||
|
@ -17,7 +17,6 @@ test.serial('nuxt build', async t => {
|
|||||||
const { stdout, stderr } = await execify(`node ${nuxtBin} build ${rootDir}`)
|
const { stdout, stderr } = await execify(`node ${nuxtBin} build ${rootDir}`)
|
||||||
|
|
||||||
t.true(stdout.includes('server-bundle.json'))
|
t.true(stdout.includes('server-bundle.json'))
|
||||||
t.true(stderr.includes('Building done'))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test.serial('nuxt build -> error config', async t => {
|
test.serial('nuxt build -> error config', async t => {
|
||||||
|
26
yarn.lock
26
yarn.lock
@ -6048,6 +6048,10 @@ prettier@^1.7.0:
|
|||||||
version "1.11.1"
|
version "1.11.1"
|
||||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75"
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75"
|
||||||
|
|
||||||
|
pretty-bytes@^4.0.2:
|
||||||
|
version "4.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||||
|
|
||||||
pretty-error@^2.0.2, pretty-error@^2.1.1:
|
pretty-error@^2.0.2, pretty-error@^2.1.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
||||||
@ -7409,7 +7413,7 @@ uglify-to-browserify@~1.0.0:
|
|||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
|
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
|
||||||
|
|
||||||
uglifyjs-webpack-plugin@^1.1.1, uglifyjs-webpack-plugin@^1.2.3:
|
uglifyjs-webpack-plugin@^1.1.1:
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.3.tgz#bf23197b37a8fc953fecfbcbab66e506f9a0ae72"
|
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.3.tgz#bf23197b37a8fc953fecfbcbab66e506f9a0ae72"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -7791,6 +7795,18 @@ webpack-sources@^1.0.1, webpack-sources@^1.1.0:
|
|||||||
source-list-map "^2.0.0"
|
source-list-map "^2.0.0"
|
||||||
source-map "~0.6.1"
|
source-map "~0.6.1"
|
||||||
|
|
||||||
|
webpack-stylish@^0.1.6:
|
||||||
|
version "0.1.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/webpack-stylish/-/webpack-stylish-0.1.6.tgz#66edd985aaa00d9649a37762c863ef63fb8b4241"
|
||||||
|
dependencies:
|
||||||
|
chalk "^2.3.0"
|
||||||
|
log-symbols "^2.2.0"
|
||||||
|
plur "^2.1.2"
|
||||||
|
pretty-bytes "^4.0.2"
|
||||||
|
strip-ansi "^4.0.0"
|
||||||
|
text-table "^0.2.0"
|
||||||
|
wordwrap "^1.0.0"
|
||||||
|
|
||||||
webpack@^4.1.1:
|
webpack@^4.1.1:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.1.1.tgz#44e4d6a869dd36fdfc0b227f9bd865a4bccfd81c"
|
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.1.1.tgz#44e4d6a869dd36fdfc0b227f9bd865a4bccfd81c"
|
||||||
@ -7871,14 +7887,14 @@ wordwrap@0.0.2:
|
|||||||
version "0.0.2"
|
version "0.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
||||||
|
|
||||||
|
wordwrap@^1.0.0, wordwrap@~1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
|
||||||
|
|
||||||
wordwrap@~0.0.2:
|
wordwrap@~0.0.2:
|
||||||
version "0.0.3"
|
version "0.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
|
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
|
||||||
|
|
||||||
wordwrap@~1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
|
|
||||||
|
|
||||||
worker-farm@^1.5.2:
|
worker-farm@^1.5.2:
|
||||||
version "1.6.0"
|
version "1.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0"
|
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0"
|
||||||
|
Loading…
Reference in New Issue
Block a user