aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
Diffstat (limited to 'vnext')
-rw-r--r--vnext/server/webpack.config.js59
-rw-r--r--vnext/src/ui/Icon.js4
2 files changed, 16 insertions, 47 deletions
diff --git a/vnext/server/webpack.config.js b/vnext/server/webpack.config.js
index 9ffb3360..78c90050 100644
--- a/vnext/server/webpack.config.js
+++ b/vnext/server/webpack.config.js
@@ -1,21 +1,17 @@
-const ESLintPlugin = require('eslint-webpack-plugin')
-const TerserPlugin = require('terser-webpack-plugin')
+const nodeExternals = require('webpack-node-externals')
+const path = require('path')
-module.exports = () => {
- const node_env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'
- const dev = node_env !== 'production'
- const config = {
- mode: node_env,
- devtool: dev ? 'cheap-module-source-map' : false,
+module.exports = {
+ devtool: false,
entry: {
'server': [
- __dirname + '/index.js'
+ path.resolve(__dirname, 'index.js')
]
},
target: 'node',
output: {
- path: __dirname + '/../../public',
- filename: '[name].js'
+ path: path.resolve(__dirname, '../../public'),
+ filename: '[name].js',
},
module: {
rules: [{
@@ -26,7 +22,8 @@ module.exports = () => {
loader: 'babel-loader'
}, {
test: /\.(png|jpe?g|gif|svg)$/i,
- type: 'asset/resource'
+ type: 'asset/resource',
+ dependency: { not: ['url'] },
}]
},
plugins: [
@@ -34,37 +31,9 @@ module.exports = () => {
resolve: {
symlinks: false,
extensions: ['.js']
- }
- }
- if (dev) {
- config.plugins.push(
- new ESLintPlugin({
- files: __dirname + '/src',
- lintDirtyModulesOnly: true,
- failOnWarning: false,
- failOnError: true,
- fix: false
- }))
- config.devServer = {
- hot: true,
- historyApiFallback: true,
- client: {
- overlay: {
- runtimeErrors: true
- }
- }
- }
- }
- config.optimization = {
- minimize: !dev,
- minimizer: [
- new TerserPlugin({
- minify: TerserPlugin.swcMinify,
- // `terserOptions` options will be passed to `swc` (`@swc/core`)
- // Link to options - https://swc.rs/docs/config-js-minify
- terserOptions: {},
- }),
- ]
+ },
+ externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
+ externals: [nodeExternals({
+ allowlist: [/\.(?!(?:jsx?|json)$).{1,5}$/i]
+ })],
}
- return config
-}
diff --git a/vnext/src/ui/Icon.js b/vnext/src/ui/Icon.js
index bc5ce08a..19f1387c 100644
--- a/vnext/src/ui/Icon.js
+++ b/vnext/src/ui/Icon.js
@@ -1,7 +1,7 @@
import { createElement, memo } from 'react'
import PropTypes from 'prop-types'
-import evilIcons from 'evil-icons/assets/sprite.svg'
+const spritesUrl = new URL('evil-icons/assets/sprite.svg', import.meta.url)
/**
* @typedef {object} IconProps
@@ -21,7 +21,7 @@ function IconElement(props) {
var klass = 'icon' + (!props.noFill ? ' icon--' + props.name : '') + size + className
var name = '#' + props.name + '-icon'
- var useTag = `<use xlink:href='${evilIcons}${name}' />`
+ var useTag = `<use xlink:href='${spritesUrl}${name}' />`
var Icon = createElement('svg', { className: 'icon__cnt', dangerouslySetInnerHTML: { __html: useTag } })
return createElement(
'div',