From 5a30741ef70d8a11e2f1976229957983f9c08fad Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 6 Aug 2024 22:11:57 +0300 Subject: Fix vnext server build --- package-lock.json | 12 ++++++++- package.json | 5 ++-- src/main/assets/icon.js | 4 +-- vnext/server/webpack.config.js | 59 ++++++++++-------------------------------- vnext/src/ui/Icon.js | 4 +-- 5 files changed, 32 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2120387..114eca7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -77,7 +77,8 @@ "supertest": "^7.0.0", "webpack": "^5.94.0", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.0.4" + "webpack-dev-server": "^5.0.4", + "webpack-node-externals": "^3.0.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -21037,6 +21038,15 @@ "node": ">=10.0.0" } }, + "node_modules/webpack-node-externals": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz", + "integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", diff --git a/package.json b/package.json index f4370f94..b8c48d0f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "lint": "eslint src/main/assets", "vnext:build": "webpack -c vnext/webpack.config.js --mode production --progress", "vnext:build:ssr": "npm run vnext:build && webpack -c vnext/server/webpack.config.js --mode production", - "vnext:start-ssr": "npm run vnext:build:ssr && cross-env DEBUG=http node --enable-source-maps public/server.js", + "vnext:start-ssr": "npm run vnext:build && webpack -c vnext/server/webpack.config.js --mode development && cross-env DEBUG=http node --enable-source-maps public/server.js", "vnext:start": "webpack serve -c vnext/webpack.config.js --mode development", "vnext:lint": "eslint vnext", "bridge:build": "webpack -c bridge/webpack.config.js --mode production" @@ -62,7 +62,8 @@ "supertest": "^7.0.0", "webpack": "^5.94.0", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.0.4" + "webpack-dev-server": "^5.0.4", + "webpack-node-externals": "^3.0.0" }, "dependencies": { "axios": "^1.7.5", diff --git a/src/main/assets/icon.js b/src/main/assets/icon.js index 5cd787a5..b4b5aedc 100644 --- a/src/main/assets/icon.js +++ b/src/main/assets/icon.js @@ -1,10 +1,10 @@ -import evilIcons from 'evil-icons/assets/sprite.svg' +const spritesUrl = new URL('evil-icons/assets/sprite.svg', import.meta.url) function icon(name, { size = '', className = '' }) { const classes = `icon icon--${name} icon--${size} ${className}`.trim() var icon = '' var html = '