Selaa lähdekoodia

Make chunks named

Tusooa Zhu 2 vuotta sitten
vanhempi
sitoutus
a758e18dce
4 muutettua tiedostoa jossa 6 lisäystä ja 3 poistoa
  1. 1 1
      .babelrc
  2. 2 1
      build/webpack.base.conf.js
  3. 1 0
      src/i18n/messages.js
  4. 2 1
      src/modules/instance.js

+ 1 - 1
.babelrc

@@ -1,5 +1,5 @@
 {
   "presets": ["@babel/preset-env"],
   "plugins": ["@babel/plugin-transform-runtime", "lodash", "@vue/babel-plugin-jsx"],
-  "comments": false
+  "comments": true
 }

+ 2 - 1
build/webpack.base.conf.js

@@ -24,7 +24,8 @@ module.exports = {
   output: {
     path: config.build.assetsRoot,
     publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
-    filename: '[name].js'
+    filename: '[name].js',
+    chunkFilename: '[name].js'
   },
   optimization: {
     splitChunks: {

+ 1 - 0
src/i18n/messages.js

@@ -14,6 +14,7 @@ const hasLanguageFile = (code) => languages.includes(code)
 const loadLanguageFile = (code) => {
   return import(
     /* webpackInclude: /\.json$/ */
+    /* webpackChunkName: "i18n/[request]" */
     `./${langCodeToJsonName(code)}.json`
   )
 }

+ 2 - 1
src/modules/instance.js

@@ -133,6 +133,7 @@ const defaultState = {
 
 const loadAnnotations = (lang) => {
   return import(
+    /* webpackChunkName: "emoji-annotations/[request]" */
     `@kazvmoe-infra/unicode-emoji-json/annotations/${langCodeToCldrName(lang)}.json`
   )
     .then(k => k.default)
@@ -234,7 +235,7 @@ const instance = {
     },
     async getStaticEmoji ({ commit }) {
       try {
-        const values = (await import('../../static/emoji.json')).default
+        const values = (await import(/* webpackChunkName: 'emoji' */ '../../static/emoji.json')).default
 
         const emoji = Object.keys(values).reduce((res, groupId) => {
           res[groupId] = values[groupId].map(e => ({