Upgrade webpack config and inline svg-s
This commit is contained in:
parent
81a8834c4d
commit
f1a2131540
14 changed files with 34437 additions and 218 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
.dockerignore
|
.dockerignore
|
||||||
Dockerfile
|
Dockerfile
|
||||||
**/node_modules
|
**/node_modules
|
||||||
|
node_modules
|
||||||
|
**/package-lock.json
|
||||||
|
package-lock.json
|
||||||
|
|
|
||||||
11
Dockerfile
11
Dockerfile
|
|
@ -1,15 +1,20 @@
|
||||||
FROM node:14.13.0-alpine3.10 as build
|
FROM node:14.13.0-alpine3.10 as build
|
||||||
|
RUN npm install -g npm@7
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm i -g concurrently
|
|
||||||
RUN yarn && yarn run build
|
RUN npm install --legacy-peer-deps
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
FROM node:14.13.0-alpine3.10
|
FROM node:14.13.0-alpine3.10
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
COPY backend/package.json .
|
COPY backend/package.json .
|
||||||
RUN npm i --production
|
RUN npm install --production
|
||||||
|
|
||||||
COPY --from=build backend/dist/main.js main.js
|
COPY --from=build backend/dist/main.js main.js
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
|
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
|
||||||
"main": "dist/main.js",
|
"main": "dist/main.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"declared-server": "./dist/main.js"
|
"declared-server": "dist/main.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx webpack --mode production",
|
"build": "npx webpack --mode production",
|
||||||
|
|
@ -17,15 +17,15 @@
|
||||||
"@types/config": "0.0.36",
|
"@types/config": "0.0.36",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"gl-matrix": "^3.3.0",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"socket.io": "^2.3.0",
|
"socket.io": "^2.3.0",
|
||||||
"uws": "^10.148.1",
|
"uws": "^10.148.1"
|
||||||
"gl-matrix": "^3.3.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/minimist": "^1.2.0",
|
|
||||||
"@types/cors": "^2.8.7",
|
"@types/cors": "^2.8.7",
|
||||||
"@types/express": "^4.17.8",
|
"@types/express": "^4.17.8",
|
||||||
|
"@types/minimist": "^1.2.0",
|
||||||
"@types/node": "^14.11.2",
|
"@types/node": "^14.11.2",
|
||||||
"@types/socket.io": "^2.1.11",
|
"@types/socket.io": "^2.1.11",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||||
|
|
@ -39,17 +39,16 @@
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"eslint-plugin-unused-imports": "^0.1.3",
|
"eslint-plugin-unused-imports": "^0.1.3",
|
||||||
"file-loader": "^6.1.0",
|
"file-loader": "^6.1.0",
|
||||||
"ts-loader": "^8.0.3",
|
|
||||||
"nodemon": "^2.0.4",
|
"nodemon": "^2.0.4",
|
||||||
"webpack-node-externals": "^2.5.2",
|
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"raw-loader": "^4.0.1",
|
"raw-loader": "^4.0.1",
|
||||||
"resolve-url-loader": "^3.1.1",
|
"resolve-url-loader": "^3.1.1",
|
||||||
"shared": "0.0.0",
|
|
||||||
"terser-webpack-plugin": "^2.3.5",
|
"terser-webpack-plugin": "^2.3.5",
|
||||||
|
"ts-loader": "^8.0.3",
|
||||||
"typescript": "^4.0.3",
|
"typescript": "^4.0.3",
|
||||||
"webpack": "^4.43.0",
|
"webpack": "^4.43.0",
|
||||||
"webpack-cli": "^3.3.11",
|
"webpack-cli": "^3.3.12",
|
||||||
"webpack-dev-server": "^3.10.3"
|
"webpack-dev-server": "^3.10.3",
|
||||||
|
"webpack-node-externals": "^2.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"sourceMap": true,
|
"skipLibCheck": true,
|
||||||
"declaration": true,
|
|
||||||
"declarationMap": true,
|
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|
|
||||||
34321
frontend/package-lock.json
generated
Normal file
34321
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -20,47 +20,30 @@
|
||||||
"@types/socket.io-client": "^1.4.34",
|
"@types/socket.io-client": "^1.4.34",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||||
"@typescript-eslint/parser": "^3.9.1",
|
"@typescript-eslint/parser": "^3.9.1",
|
||||||
"autoprefixer": "^9.8.5",
|
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"css-loader": "^3.5.2",
|
"common-config-webpack-plugin": "^2.0.1",
|
||||||
"cssnano": "^4.1.10",
|
|
||||||
"eslint": "^7.2.0",
|
"eslint": "^7.2.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-import": "^2.21.2",
|
"eslint-plugin-import": "^2.21.2",
|
||||||
"eslint-plugin-json-format": "^2.0.1",
|
"eslint-plugin-json-format": "^2.0.1",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"eslint-plugin-unused-imports": "^0.1.3",
|
"eslint-plugin-unused-imports": "^0.1.3",
|
||||||
"file-loader": "^6.1.0",
|
|
||||||
"firebase": "^7.22.0",
|
"firebase": "^7.22.0",
|
||||||
"gl-matrix": "^3.3.0",
|
"gl-matrix": "^3.3.0",
|
||||||
"html-webpack-inline-source-plugin": "0.0.10",
|
"html-webpack-inline-svg-plugin": "^2.3.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^4.5.0",
|
||||||
"image-webpack-loader": "^6.0.0",
|
"image-config-webpack-plugin": "^2.0.0",
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
|
||||||
"postcss-loader": "^3.0.0",
|
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"raw-loader": "^4.0.1",
|
|
||||||
"resolve-url-loader": "^3.1.1",
|
|
||||||
"ts-loader": "^8.0.3",
|
|
||||||
"sass": "^1.26.3",
|
|
||||||
"sass-loader": "^9.0.2",
|
|
||||||
"sdf-2d": "^0.6.0",
|
|
||||||
"shared": "0.0.0",
|
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
|
"resolve-url-loader": "^3.1.1",
|
||||||
|
"scss-config-webpack-plugin": "^2.0.0",
|
||||||
|
"sdf-2d": "^0.6.0",
|
||||||
"socket.io-client": "^2.3.1",
|
"socket.io-client": "^2.3.1",
|
||||||
"source-map-loader": "^1.1.0",
|
"source-map-loader": "^1.1.1",
|
||||||
"svg-url-loader": "^6.0.0",
|
"ts-config-webpack-plugin": "^2.0.0",
|
||||||
"terser-webpack-plugin": "^4.2.2",
|
|
||||||
"typescript": "^4.0.3",
|
"typescript": "^4.0.3",
|
||||||
"webpack": "^4.43.0",
|
"webpack": "^4.43.0",
|
||||||
"webpack-bundle-analyzer": "^3.9.0",
|
|
||||||
"webpack-cli": "^3.3.11",
|
"webpack-cli": "^3.3.11",
|
||||||
"webpack-dev-server": "^3.10.3"
|
"webpack-dev-server": "^3.11.0"
|
||||||
},
|
|
||||||
"postcss": {
|
|
||||||
"plugins": {
|
|
||||||
"autoprefixer": {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,20 +50,20 @@
|
||||||
<section id="settings">
|
<section id="settings">
|
||||||
<label for="enable-relative-movement">
|
<label for="enable-relative-movement">
|
||||||
<input id="enable-relative-movement" type="checkbox" />
|
<input id="enable-relative-movement" type="checkbox" />
|
||||||
<img alt="a dashed circle" src="static/circle.svg" />
|
<img alt="a dashed circle" src="../static/circle.svg" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="enable-vibration">
|
<label for="enable-vibration">
|
||||||
<input id="enable-vibration" type="checkbox" />
|
<input id="enable-vibration" type="checkbox" />
|
||||||
<img alt="vibrating mobile" src="static/vibrate.svg" />
|
<img alt="vibrating mobile" src="../static/vibrate.svg" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="enable-sounds">
|
<label for="enable-sounds">
|
||||||
<input id="enable-sounds" type="checkbox" />
|
<input id="enable-sounds" type="checkbox" />
|
||||||
<img alt="speaker with sound waves" src="static/volume.svg" />
|
<img alt="speaker with sound waves" src="../static/volume.svg" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<img id="logout" alt="logout" src="static/logout.svg" />
|
<img id="logout" alt="logout" src="../static/logout.svg" />
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
id="toggle-settings"
|
id="toggle-settings"
|
||||||
class="icon"
|
class="icon"
|
||||||
alt="toggle-settings"
|
alt="toggle-settings"
|
||||||
src="static/settings.svg"
|
src="../static/settings.svg"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -80,13 +80,13 @@
|
||||||
class="full-screen-controllers"
|
class="full-screen-controllers"
|
||||||
id="minimize"
|
id="minimize"
|
||||||
alt="minimize-application"
|
alt="minimize-application"
|
||||||
src="static/minimize.svg"
|
src="../static/minimize.svg"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
class="full-screen-controllers"
|
class="full-screen-controllers"
|
||||||
id="maximize"
|
id="maximize"
|
||||||
alt="maximize-application"
|
alt="maximize-application"
|
||||||
src="static/maximize.svg"
|
src="../static/maximize.svg"
|
||||||
/>
|
/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,12 @@ import { CharacterView } from './scripts/objects/character-view';
|
||||||
import { LampView } from './scripts/objects/lamp-view';
|
import { LampView } from './scripts/objects/lamp-view';
|
||||||
import { ProjectileView } from './scripts/objects/projectile-view';
|
import { ProjectileView } from './scripts/objects/projectile-view';
|
||||||
import { PlanetView } from './scripts/objects/planet-view';
|
import { PlanetView } from './scripts/objects/planet-view';
|
||||||
import './styles/main.scss';
|
import './main.scss';
|
||||||
import { LandingPageBackground } from './scripts/landing-page-background';
|
import { LandingPageBackground } from './scripts/landing-page-background';
|
||||||
import { JoinFormHandler } from './scripts/join-form-handler';
|
import { JoinFormHandler } from './scripts/join-form-handler';
|
||||||
import { handleFullScreen } from './scripts/handle-full-screen';
|
import { handleFullScreen } from './scripts/handle-full-screen';
|
||||||
import { Game } from './scripts/game';
|
import { Game } from './scripts/game';
|
||||||
import { PlayerCharacterView } from './scripts/objects/player-character-view';
|
import { PlayerCharacterView } from './scripts/objects/player-character-view';
|
||||||
import '../static/settings.svg';
|
|
||||||
import '../static/minimize.svg';
|
|
||||||
import '../static/maximize.svg';
|
|
||||||
import { handleInsights } from './scripts/handle-insights';
|
import { handleInsights } from './scripts/handle-insights';
|
||||||
import { getInsightsFromRenderer } from './scripts/get-insights-from-renderer';
|
import { getInsightsFromRenderer } from './scripts/get-insights-from-renderer';
|
||||||
import { Renderer } from 'sdf-2d';
|
import { Renderer } from 'sdf-2d';
|
||||||
|
|
@ -90,7 +87,6 @@ const toggleSettings = () =>
|
||||||
|
|
||||||
const applyServerContainerShadows = () => {
|
const applyServerContainerShadows = () => {
|
||||||
const { scrollHeight, clientHeight, scrollTop } = serverContainer;
|
const { scrollHeight, clientHeight, scrollTop } = serverContainer;
|
||||||
console.log(scrollHeight, clientHeight, scrollTop);
|
|
||||||
if (scrollHeight > clientHeight) {
|
if (scrollHeight > clientHeight) {
|
||||||
serverContainer.className = 'scroll';
|
serverContainer.className = 'scroll';
|
||||||
if (scrollTop === 0) {
|
if (scrollTop === 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
@import './vars.scss';
|
@import './styles/vars.scss';
|
||||||
@import './button.scss';
|
@import './styles/button.scss';
|
||||||
@import './form.scss';
|
@import './styles/form.scss';
|
||||||
@import './mixins.scss';
|
@import './styles/mixins.scss';
|
||||||
@import './settings.scss';
|
@import './styles/settings.scss';
|
||||||
|
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300&family=Open+Sans&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300&family=Open+Sans&display=swap');
|
||||||
|
|
||||||
|
|
@ -148,13 +148,14 @@ body {
|
||||||
&::-webkit-scrollbar-track,
|
&::-webkit-scrollbar-track,
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
width: 2px;
|
width: 3px;
|
||||||
}
|
}
|
||||||
&::-webkit-scrollbar-thumb {
|
&::-webkit-scrollbar-thumb {
|
||||||
background-color: $accent;
|
background-color: $accent;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transition: box-shadow $animation-time;
|
||||||
&.scroll {
|
&.scroll {
|
||||||
box-shadow: inset 0 -8px 8px -8px rgba(0, 0, 0, 0.4),
|
box-shadow: inset 0 -8px 8px -8px rgba(0, 0, 0, 0.4),
|
||||||
inset 0 8px 8px -8px rgba(0, 0, 0, 0.4);
|
inset 0 8px 8px -8px rgba(0, 0, 0, 0.4);
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
@ -16,17 +15,17 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
#toggle-settings {
|
#toggle-settings {
|
||||||
@include square($large-icon);
|
|
||||||
@media (max-width: $breakpoint) {
|
|
||||||
@include square($small-icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
animation: spin 32s linear infinite;
|
animation: spin 32s linear infinite;
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
100% {
|
100% {
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@include square($large-icon);
|
||||||
|
@media (max-width: $breakpoint) {
|
||||||
|
@include square($small-icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,10 +58,12 @@
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img,
|
||||||
|
svg {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: opacity $animation-time;
|
transition: opacity $animation-time;
|
||||||
margin-bottom: $small-padding;
|
margin-bottom: $small-padding;
|
||||||
|
margin-left: 0;
|
||||||
@include square($large-icon);
|
@include square($large-icon);
|
||||||
@media (max-width: $breakpoint) {
|
@media (max-width: $breakpoint) {
|
||||||
@include square($small-icon);
|
@include square($small-icon);
|
||||||
|
|
@ -73,7 +74,6 @@
|
||||||
|
|
||||||
label {
|
label {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
|
||||||
|
|
||||||
input[type='checkbox'] {
|
input[type='checkbox'] {
|
||||||
width: 0;
|
width: 0;
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
appearance: none;
|
appearance: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:not(:checked) + img {
|
&:not(:checked) + * {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,3 +120,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"skipLibCheck": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"composite": true,
|
|
||||||
"lib": ["dom", "es2017"]
|
"lib": ["dom", "es2017"]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/*.ts"]
|
"include": ["src/**/*.ts", "src/*.ts"]
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,10 @@
|
||||||
const path = require('path');
|
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
const ScssConfigWebpackPlugin = require('scss-config-webpack-plugin');
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin');
|
||||||
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
|
|
||||||
const Sass = require('sass');
|
|
||||||
const TerserJSPlugin = require('terser-webpack-plugin');
|
|
||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
||||||
|
|
||||||
const PATHS = {
|
module.exports = {
|
||||||
entryPoint: path.resolve(__dirname, 'src/index.ts'),
|
|
||||||
bundles: path.resolve(__dirname, 'dist'),
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = (env, argv) => ({
|
|
||||||
entry: {
|
|
||||||
index: PATHS.entryPoint,
|
|
||||||
},
|
|
||||||
target: 'web',
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
path: PATHS.bundles,
|
|
||||||
},
|
|
||||||
devtool: argv.mode === 'development' ? 'source-map' : false,
|
|
||||||
devServer: {
|
devServer: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
|
|
@ -30,94 +12,30 @@ module.exports = (env, argv) => ({
|
||||||
poll: true,
|
poll: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
optimization: {
|
|
||||||
minimize: argv.mode !== 'development',
|
|
||||||
minimizer: [
|
|
||||||
new TerserJSPlugin({
|
|
||||||
sourceMap: false,
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
terserOptions: {
|
|
||||||
keep_classnames: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
new OptimizeCSSAssetsPlugin({}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
|
// Cleans the dist folder before the build starts
|
||||||
|
new CleanWebpackPlugin(),
|
||||||
|
// Generate a base html file and injects all generated css and js files
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
xhtml: true,
|
|
||||||
template: './src/index.html',
|
template: './src/index.html',
|
||||||
minify: {
|
}),
|
||||||
collapseWhitespace: true,
|
new HtmlWebpackInlineSVGPlugin({
|
||||||
removeComments: true,
|
inlineAll: true,
|
||||||
removeRedundantAttributes: true,
|
svgoConfig: [
|
||||||
removeScriptTypeAttributes: true,
|
{
|
||||||
removeStyleLinkTypeAttributes: true,
|
removeViewBox: false,
|
||||||
useShortDoctype: true,
|
|
||||||
},
|
},
|
||||||
inlineSource: '.(js|css)$',
|
],
|
||||||
}),
|
|
||||||
new HtmlWebpackInlineSourcePlugin(),
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: '[name].css',
|
|
||||||
chunkFilename: '[id].css',
|
|
||||||
}),
|
|
||||||
new CleanWebpackPlugin({
|
|
||||||
protectWebpackAssets: false,
|
|
||||||
cleanAfterEveryBuildPatterns: ['*', '!index.html', '!static*'],
|
|
||||||
}),
|
}),
|
||||||
|
// SCSS Configuration for .css .module.css and .scss .module.scss files
|
||||||
|
// see https://github.com/namics/webpack-config-plugins/tree/master/packages/scss-config-webpack-plugin/config
|
||||||
|
new ScssConfigWebpackPlugin(),
|
||||||
|
// Multi threading typescript loader configuration with caching for .ts and .tsx files
|
||||||
|
// see https://github.com/namics/webpack-config-plugins/tree/master/packages/ts-config-webpack-plugin/config
|
||||||
|
new TsConfigWebpackPlugin(),
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
|
||||||
test: /\.ico$/,
|
|
||||||
use: {
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
outputPath: '/',
|
|
||||||
name: '[name].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.svg$/,
|
|
||||||
use: {
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
outputPath: '/static',
|
|
||||||
name: '[name].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.scss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
'css-loader',
|
|
||||||
'postcss-loader',
|
|
||||||
{
|
|
||||||
loader: 'resolve-url-loader',
|
|
||||||
options: {
|
|
||||||
keepQuery: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'sass-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true,
|
|
||||||
implementation: Sass,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.ts$/,
|
|
||||||
use: {
|
|
||||||
loader: 'ts-loader',
|
|
||||||
},
|
|
||||||
exclude: /node_modules/,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
|
|
@ -125,7 +43,4 @@ module.exports = (env, argv) => ({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
};
|
||||||
extensions: ['.ts', '.js'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,17 @@
|
||||||
"frontend",
|
"frontend",
|
||||||
"shared",
|
"shared",
|
||||||
"backend"
|
"backend"
|
||||||
],
|
|
||||||
"nohoist": [
|
|
||||||
"**"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"concurrently": "^5.3.0"
|
"concurrently": "^5.3.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn workspace shared run build && yarn workspace decla.red-frontend run build && yarn workspace declared-server run build",
|
"build": "cd shared && npm run build && cd ../frontend && npm run build && cd ../backend && npm run build",
|
||||||
"lint": "eslint './**/src/**/*.{js,ts,json}' --fix",
|
"lint": "eslint './**/src/**/*.{js,ts,json}' --fix",
|
||||||
"frontend": "yarn workspace decla.red-frontend start",
|
"frontend": "yarn workspace decla.red-frontend start",
|
||||||
"shared": "yarn workspace shared start",
|
"shared": "yarn workspace shared start",
|
||||||
"backend": "yarn workspace declared-server start",
|
"backend": "yarn workspace declared-server start",
|
||||||
"start": "concurrently --kill-others-on-fail \"yarn frontend\" \"yarn shared\" \"yarn backend\""
|
"start": "concurrently --kill-others-on-fail \"cd shared && npm start\" \"cd backend && npm start\" \"cd frontend && npm start\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,6 @@
|
||||||
"ts-loader": "^8.0.3",
|
"ts-loader": "^8.0.3",
|
||||||
"typescript": "^4.0.3",
|
"typescript": "^4.0.3",
|
||||||
"webpack": "^4.43.0",
|
"webpack": "^4.43.0",
|
||||||
"webpack-cli": "^3.3.11"
|
"webpack-cli": "^3.3.12"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue