Skip to content

Commit

Permalink
feat: upgrade webpack (vuejs#4253)
Browse files Browse the repository at this point in the history
  • Loading branch information
DRoet authored and haoqunjiang committed Aug 12, 2019
1 parent 1cf9b14 commit 428d172
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 10 additions & 7 deletions packages/@vue/cli-service/__tests__/multiPage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>/)
Expand Down Expand Up @@ -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>/)
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 428d172

Please sign in to comment.