feat: upgrade webpack (#4253)

This commit is contained in:
Daan Roet
2019-08-12 15:58:58 +02:00
committed by Haoqun Jiang
parent 1cf9b14d89
commit 428d1720fe
7 changed files with 16 additions and 13 deletions

View File

@@ -78,7 +78,7 @@
"semver": "^6.1.0",
"typescript": "^3.4.5",
"vuepress": "^1.0.1",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"yorkie": "^2.0.0"
},
"resolutions": {

View File

@@ -24,7 +24,7 @@
"@vue/babel-preset-app": "^4.0.0-beta.3",
"@vue/cli-shared-utils": "^4.0.0-beta.3",
"babel-loader": "^8.0.6",
"webpack": ">=4 < 4.29"
"webpack": "^4.0.0"
},
"peerDependencies": {
"@vue/cli-service": "^3.0.0 || ^4.0.0-0"

View File

@@ -26,7 +26,7 @@
"@vue/cli-shared-utils": "^4.0.0-beta.3",
"eslint-loader": "^2.1.2",
"globby": "^9.2.0",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"yorkie": "^2.0.0"
},
"peerDependencies": {

View File

@@ -24,7 +24,7 @@
},
"dependencies": {
"@vue/cli-shared-utils": "^4.0.0-beta.3",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"workbox-webpack-plugin": "^4.3.1"
},
"devDependencies": {

View File

@@ -29,7 +29,7 @@
"globby": "^9.2.0",
"ts-loader": "^6.0.1",
"tslint": "^5.16.0",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"yorkie": "^2.0.0"
},
"peerDependencies": {

View File

@@ -99,18 +99,16 @@ test('build w/ multi page', async () => {
const assertSharedAssets = file => {
// should split and preload vendor chunk
expect(file).toMatch(/<link [^>]*js\/chunk-vendors[^>]*\.js rel=preload as=script>/)
// should split and preload common js and css
expect(file).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js rel=preload as=script>/)
expect(file).toMatch(/<link [^>]*chunk-common[^>]*\.css rel=preload as=style>/)
// should load common css
expect(file).toMatch(/<link href=\/css\/chunk-common\.\w+\.css rel=stylesheet>/)
// should load common js
expect(file).toMatch(/<script [^>]*src=\/js\/chunk-vendors\.\w+\.js>/)
expect(file).toMatch(/<script [^>]*src=\/js\/chunk-common\.\w+\.js>/)
}
const index = await project.read('dist/index.html')
assertSharedAssets(index)
// should split and preload common js and css
expect(index).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js rel=preload as=script>/)
expect(index).toMatch(/<script [^>]*src=\/js\/chunk-common\.\w+\.js>/)
expect(index).toMatch(/<link href=\/css\/chunk-common\.\w+\.css rel=stylesheet>/)
expect(index).toMatch(/<link [^>]*chunk-common[^>]*\.css rel=preload as=style>/)
// should preload correct page file
expect(index).toMatch(/<link [^>]*js\/index[^>]*\.js rel=preload as=script>/)
expect(index).not.toMatch(/<link [^>]*js\/foo[^>]*\.js rel=preload as=script>/)
@@ -140,6 +138,11 @@ test('build w/ multi page', async () => {
const bar = await project.read('dist/bar.html')
assertSharedAssets(bar)
// bar & index have a shared common chunk (App.vue)
expect(bar).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js rel=preload as=script>/)
expect(bar).toMatch(/<script [^>]*src=\/js\/chunk-common\.\w+\.js>/)
expect(bar).toMatch(/<link href=\/css\/chunk-common\.\w+\.css rel=stylesheet>/)
expect(bar).toMatch(/<link [^>]*chunk-common[^>]*\.css rel=preload as=style>/)
// should preload correct page file
expect(bar).not.toMatch(/<link [^>]*js\/index[^>]*\.js rel=preload as=script>/)
expect(bar).not.toMatch(/<link [^>]*js\/foo[^>]*\.js rel=preload as=script>/)

View File

@@ -73,7 +73,7 @@
"thread-loader": "^2.1.2",
"url-loader": "^2.1.0",
"vue-loader": "^15.7.0",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-chain": "^6.0.0",
"webpack-dev-server": "^3.4.1",