Skip to content
Snippets Groups Projects
Unverified Commit c2e7de93 authored by David Négrier's avatar David Négrier Committed by GitHub
Browse files

Merge pull request #37 from thecodingmachine/vite

Replace Webpack by Vite
parents 6e9e4ed2 fd4c8e63
Branches
Tags v3.0.0
No related merge requests found
{ {
"name": "workadventure-map-starter-kit", "name": "workadventure-map-starter-kit",
"version": "2.0.0", "version": "3.0.0",
"main": "index.js",
"license": "MIT", "license": "MIT",
"devDependencies": {
"@workadventure/iframe-api-typings": "^1.10.0",
"eslint": "^7.24.0",
"html-webpack-plugin": "^5.3.2",
"ts-loader": "^9.2.5",
"ts-node": "^10.2.1",
"typescript": "^4.2.4",
"webpack": "^5.31.2",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.7.4",
"webpack-merge": "^5.7.3"
},
"scripts": { "scripts": {
"dev": "webpack serve", "dev": "vite",
"start": "webpack serve --open", "build": "tsc && vite build",
"build": "webpack --config webpack.prod.js", "preview": "vite preview"
"test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json", },
"lint": "node_modules/.bin/eslint src/ . --ext .ts", "devDependencies": {
"fix": "node_modules/.bin/eslint --fix src/ . --ext .ts" "@types/node": "^17.0.36",
"typescript": "^4.5.4",
"vite": "^2.9.9",
"wa-map-optimizer-vite": "^1.0.0"
}, },
"dependencies": { "dependencies": {
"@workadventure/iframe-api-typings": "^1.10.3",
"@workadventure/scripting-api-extra": "^1.3.2" "@workadventure/scripting-api-extra": "^1.3.2"
} }
} }
/// <reference path="../node_modules/@workadventure/iframe-api-typings/iframe_api.d.ts" />
import { bootstrapExtra } from "@workadventure/scripting-api-extra"; import { bootstrapExtra } from "@workadventure/scripting-api-extra";
console.log('Script started successfully'); console.log('Script started successfully');
......
body {
font-size:16px;
font-family: 'Open Sans', sans-serif;
max-width: 800px;
margin: auto !important;
text-align:center;
}
h1, h2 {
font-weight:bold;
}
header {
margin:30px;
}
header .logo {
display:block;
position:relative;
}
header .logo img{
display:block;
width:500px;
margin: auto;
text-align:center;
}
main {
margin-bottom: 30px;
}
.socials img {
width: 30px;
height: 30px;
}
.socials>a {
display:inline-block;
margin:20px 5px;
}
.content {
width:100%;
position:relative;
z-index:99999;
}
.content > h2 {
padding:1rem 5vw;
max-width:1200px;
}
a.button {
display:inline-block;
padding:13px 20px 12px;
background:rgba(20, 48, 76, 0.9);
color:white;
font-weight:bold;
text-transform:uppercase;
text-decoration:none;
text-align:center;
width:auto;
position:relative;
font-size:1.8em;
margin-top:2rem;
}
a.button:hover {
top:-3px;
background:rgba(20, 48, 76);
cursor:pointer;
color:white;
}
.maps {
display: flex;
justify-content: center;
gap: 1rem;
flex-wrap: wrap;
}
.map {
width: 30%;
margin-bottom: 3%;
min-width: 200px;
}
.map a,
.map img{
width: 100%;
display:block;
}
.map a.button {
display:inline-block;
width: auto;
margin:1rem auto;
}
.url {
font-family: 'Courier New', Courier, monospace;
font-size: 14px;
}
footer {
display:block;
font-size:1.2em;
padding:2rem 5vw;
}
/*/ MEDIA QUERIES START HERE /*/
@media (max-width: 768px) { /* Hand Held Device */
body {
font-size:13px;
}
.logo img{
width:60vw;
}
.content {
padding:1rem;
}
.maps {
gap: 1rem;
}
.map {
width: 47%;
margin-bottom: 3%;
min-width: 200px;
}
}
{ {
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/", "outDir": "./dist/",
"sourceMap": true, "target": "ESNext",
"moduleResolution": "node", "useDefineForClassFields": true,
"module": "CommonJS", "module": "ESNext",
"target": "ES2015", "lib": [
"declaration": false, "ESNext",
"downlevelIteration": true, "DOM"
"jsx": "react", ],
"allowJs": true, "allowJs": true,
"moduleResolution": "Node",
"strict": true, /* Enable all strict type-checking options. */ "strict": true,
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ "noImplicitAny": true,
"strictNullChecks": true, /* Enable strict null checks. */ "strictNullChecks": true,
"strictFunctionTypes": true, /* Enable strict checking of function types. */ "strictFunctionTypes": true,
"strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ "strictBindCallApply": true,
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ "strictPropertyInitialization": true,
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ "noImplicitThis": true,
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ "alwaysStrict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "sourceMap": true,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */ "resolveJsonModule": true,
} "isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": [
"src"
]
} }
\ No newline at end of file
import { defineConfig } from "vite";
import { getMapsOptimizers, getMapsScripts } from "wa-map-optimizer-vite";
export default defineConfig({
build: {
rollupOptions: {
input: {
index: "./index.html",
...getMapsScripts(),
},
},
},
plugins: [...getMapsOptimizers()],
server: {
host: "localhost",
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization",
},
open: "/",
},
});
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: './src/index.ts',
devtool: 'inline-source-map',
devServer: {
static: ['.'],
//host: '0.0.0.0',
host: 'localhost',
//sockPort: 80,
allowedHosts: "all",
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ],
},
output: {
filename: 'script.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
/*externals:[
require('webpack-require-http')
],*/
plugins: [
/*new webpack.ProvidePlugin({
WA: ['@workadventure/iframe-api-typings', 'window.WA']
}),*/
/*new webpack.EnvironmentPlugin({
'API_URL': null,
'PUSHER_URL': undefined,
'UPLOADER_URL': null,
'ADMIN_URL': null,
'DEBUG_MODE': null,
'STUN_SERVER': null,
'TURN_SERVER': null,
'TURN_USER': null,
'TURN_PASSWORD': null,
'JITSI_URL': null,
'JITSI_PRIVATE_MODE': null,
'START_ROOM_URL': null
})*/
],
};
const { merge } = require('webpack-merge');
const common = require('./webpack.config.js');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map'
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment