Skip to content

Commit 9c59e17

Browse files
author
Karen Baney
committed
fix regex to include @VUE in vue chunk
1 parent 499a372 commit 9c59e17

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

Lazy Way To Performance.pptx

-106 Bytes
Binary file not shown.

src/router/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Vue from 'vue'
22
import VueRouter from 'vue-router'
33
import Home from '@/views/Home.vue'
4-
import Bella from '@/components/bella'
5-
// const Bella = () => import(/* webpackChunkName: "dogs" */ '@/components/bella')
6-
import Daisy from '@/components/daisy'
7-
// const Daisy = () => import(/* webpackChunkName: "dogs" */ '@/components/daisy')
4+
// import Bella from '@/components/bella'
5+
const Bella = () => import(/* webpackChunkName: "dogs" */ '@/components/bella')
6+
// import Daisy from '@/components/daisy'
7+
const Daisy = () => import(/* webpackChunkName: "dogs" */ '@/components/daisy')
88
const About = () => import(/* webpackChunkName: "about" */ '@/views/About.vue')
99

1010
Vue.use(VueRouter)

src/views/Home.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<script>
1616
import BellaProfile from '@/components/bella'
17-
import DaisyProfile from '@/components/daisy'
18-
// const DaisyProfile = () => import(/* webpackChunkName: 'dogs' */ '@/components/daisy')
17+
// import DaisyProfile from '@/components/daisy'
18+
const DaisyProfile = () => import(/* webpackChunkName: 'dogs' */ '@/components/daisy')
1919
2020
export default {
2121
name: 'Home',

vue.config.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module.exports = {
3939
rel: 'preload',
4040
include: 'initial',
4141
fileWhitelist: [
42+
/(^@vue)(.*)(\.js$)/,
4243
/(^vue)(.*)(\.js$)/
4344
],
4445
// do not preload map files or hot update files
@@ -54,7 +55,7 @@ module.exports = {
5455
cacheGroups: {
5556
// Vue modules
5657
vue: {
57-
test: /[\\/]node_modules[\\/]vue.*[\\/]/,
58+
test: /[\\/]node_modules[\\/](@vue.*|vue.*)[\\/]/,
5859
name: 'vue',
5960
enforce: true,
6061
priority: 20,
@@ -68,8 +69,9 @@ module.exports = {
6869
// Note the usage of `path.sep` instead of / or \, for cross-platform compatibility.
6970
const path = require('path')
7071
return module.resource &&
71-
!module.resource.includes(`${path.sep}node_modules${path.sep}vue`) &&
72-
!module.resource.includes(`${path.sep}src${path.sep}`)
72+
!module.resource.includes(`${path.sep}node_modules${path.sep}@vue`) &&
73+
!module.resource.includes(`${path.sep}node_modules${path.sep}vue`) &&
74+
!module.resource.includes(`${path.sep}src${path.sep}`)
7375
},
7476
maxSize: 500000,
7577
priority: 10,
@@ -87,8 +89,8 @@ module.exports = {
8789
}
8890
})
8991

90-
// Webpack includes a small piece of runtime code that gets inserted into the last bundle created. This could cause our vendor
91-
// bundle to change unnecessarily. So the next line causes this runtime to be put in a separate file.
92+
// Webpack includes a small piece of runtime code that gets inserted into the last chunk created. This could cause our vendor
93+
// chunk to change unnecessarily. So the next line causes this runtime to be put in a separate file.
9294
config.optimization.set('runtimeChunk', true)
9395
}
9496

0 commit comments

Comments
 (0)