Pārlūkot izejas kodu

Fix chunk error when loading emojis

Remove the `browser` entry in the headless package.json, otherwise the
headless build (in src/headless/dist) is used when building converse.js,
which tries to load a different emojis.json
JC Brand 1 gadu atpakaļ
vecāks
revīzija
903a4e237a

+ 0 - 1
src/headless/package.json

@@ -8,7 +8,6 @@
   ],
   "homepage": "https://conversejs.org",
   "license": "MPL-2.0",
-  "browser": "dist/converse-headless.js",
   "main": "index.js",
   "types": "types/index.d.ts",
   "module": "index.js",

+ 0 - 6
webpack/webpack.build.js

@@ -1,11 +1,9 @@
 /* global __dirname, module, process */
-const ASSET_PATH = process.env.ASSET_PATH || '/dist/'; // eslint-disable-line no-process-env
 const CircularDependencyPlugin = require('circular-dependency-plugin');
 const CopyWebpackPlugin = require('copy-webpack-plugin');
 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 const common = require("./webpack.common.js");
 const path = require('path');
-const webpack = require('webpack');
 const { merge }  = require("webpack-merge");
 
 const plugins = [
@@ -26,9 +24,6 @@ const plugins = [
             {from: 'src/shared/styles/webfonts', to: 'webfonts'}
         ]
     }),
-    new webpack.DefinePlugin({ // This makes it possible for us to safely use env vars on our code
-        'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH)
-    }),
     new CircularDependencyPlugin({
       exclude: /node_modules/,
       failOnError: true,
@@ -44,7 +39,6 @@ module.exports = merge(common, {
         "converse.min": path.resolve(__dirname, "../src/entry.js"),
     },
     output: {
-        publicPath: ASSET_PATH,
         filename: "[name].js",
     },
     mode: "production",

+ 10 - 1
webpack/webpack.common.js

@@ -1,18 +1,27 @@
 /* global __dirname, module, process */
+const ASSET_PATH = process.env.ASSET_PATH || '/dist/'; // eslint-disable-line no-process-env
+const webpack = require('webpack');
 const TerserPlugin = require("terser-webpack-plugin");
 const path = require('path');
 
 let bootstrap_ignore_modules = ['carousel', 'scrollspy', 'tooltip', 'toast'];
 
-
 const BOOTSTRAP_IGNORE_MODULES = (process.env.BOOTSTRAP_IGNORE_MODULES || '').replace(/ /g, '').trim();
 if (BOOTSTRAP_IGNORE_MODULES.length > 0) {
     bootstrap_ignore_modules = bootstrap_ignore_modules.concat(BOOTSTRAP_IGNORE_MODULES.split(','));
 }
 
+const plugins = [
+    new webpack.DefinePlugin({ // This makes it possible for us to safely use env vars on our code
+        'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH)
+    }),
+];
+
 module.exports = {
+    plugins,
     output: {
         path: path.resolve(__dirname, '../dist'), // Output path for generated bundles
+        publicPath: ASSET_PATH,
         chunkFilename: '[name].js'
     },
     devtool: "source-map",

+ 0 - 1
webpack/webpack.headless.js

@@ -13,7 +13,6 @@ module.exports = merge(common, {
         filename: "[name].js",
         chunkFilename: '[name].js',
         globalObject: 'this',
-        publicPath: '',
         library: {
             name: 'converse',
             type: 'umd',