setup ts
This commit is contained in:
2
build.js
2
build.js
@@ -6,7 +6,7 @@ const isDev = process.argv.includes("--dev");
|
|||||||
const config = {
|
const config = {
|
||||||
entryPoints: ["frontend/static/frontend/ts/main.ts"], // il tuo entry point
|
entryPoints: ["frontend/static/frontend/ts/main.ts"], // il tuo entry point
|
||||||
bundle: true,
|
bundle: true,
|
||||||
outdir: "frontend/static/frontend/dist",
|
outdir: "frontend/static/frontend/dist/js",
|
||||||
format: "iife", // o 'iife' se serve per un tag <script> classico
|
format: "iife", // o 'iife' se serve per un tag <script> classico
|
||||||
target: "es2020",
|
target: "es2020",
|
||||||
sourcemap: isDev,
|
sourcemap: isDev,
|
||||||
|
|||||||
1
bun.lock
1
bun.lock
@@ -5,6 +5,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/maplibre-gl": "^1.14.0",
|
"@types/maplibre-gl": "^1.14.0",
|
||||||
"esbuild": "^0.27.3",
|
"esbuild": "^0.27.3",
|
||||||
|
"maplibre-gl": "^5.18.0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,21 @@
|
|||||||
import add from "./lib/add";
|
import add from "./lib/add";
|
||||||
|
|
||||||
|
import { Map } from "maplibre-gl";
|
||||||
|
|
||||||
console.log(add(1, 2));
|
console.log(add(1, 2));
|
||||||
|
|
||||||
|
const map = new Map({
|
||||||
|
style:
|
||||||
|
"https://api.maptiler.com/maps/019be805-c88e-7c8b-9850-bc704d72e604/style.json?key=8nmgHEIZQiIgqQj3RZNa",
|
||||||
|
container: "map",
|
||||||
|
zoom: 15,
|
||||||
|
});
|
||||||
|
|
||||||
|
map.on("load", () => {
|
||||||
|
navigator.geolocation.getCurrentPosition((position) => {
|
||||||
|
map.panTo({
|
||||||
|
lat: position.coords.latitude,
|
||||||
|
lng: position.coords.longitude,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js_bottom %}
|
{% block js_bottom %}
|
||||||
<script src="{% static 'frontend/dist/main.js' %}"></script>
|
<script src="{% static 'frontend/dist/js/main.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/maplibre-gl": "^1.14.0",
|
"@types/maplibre-gl": "^1.14.0",
|
||||||
"esbuild": "^0.27.3"
|
"esbuild": "^0.27.3",
|
||||||
|
"maplibre-gl": "^5.18.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run build.js --dev",
|
"dev": "bun run build.js --dev",
|
||||||
|
|||||||
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"strict": true,
|
||||||
|
"types": ["maplibre-gl"],
|
||||||
|
"lib": ["ES2020", "DOM"],
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": ["frontend/static/frontend/ts/**/*.ts"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user