Skip to content

Commit

Permalink
feat: upgrade webpack (#4253)
Browse files Browse the repository at this point in the history
(cherry picked from commit 428d172)
  • Loading branch information
DRoet authored and haoqunjiang committed Aug 21, 2019
1 parent 61485f6 commit 9525f67
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 @@ -71,7 +71,7 @@
"typescript": "^3.4.3",
"vuepress": "1.0.0-alpha.44",
"vuepress-theme-vue": "^1.1.0",
"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": "^3.10.0",
"@vue/cli-shared-utils": "^3.10.0",
"babel-loader": "^8.0.5",
"webpack": ">=4 < 4.29"
"webpack": "^4.0.0"
},
"publishConfig": {
"access": "public"
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 @@ -27,7 +27,7 @@
"babel-eslint": "^10.0.1",
"eslint-loader": "^2.1.2",
"globby": "^9.2.0",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"yorkie": "^2.0.0"
},
"optionalDependencies": {
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": "^3.10.0",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"workbox-webpack-plugin": "^3.6.3"
},
"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": "^5.3.3",
"tslint": "^5.15.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 @@ -74,7 +74,7 @@
"thread-loader": "^2.1.2",
"url-loader": "^1.1.2",
"vue-loader": "^15.7.0",
"webpack": ">=4 < 4.29",
"webpack": "^4.0.0",
"webpack-bundle-analyzer": "^3.3.0",
"webpack-chain": "^4.11.0",
"webpack-dev-server": "^3.4.1",
Expand Down

0 comments on commit 9525f67

Please sign in to comment.