Zum Hauptinhalt springen
ProdukteDesktop-WerkzeugeTASTECADZeichnungsprüfungTASTEFILESDateiverwaltungTASTEFTPDateiübertragungTASTESSHRemote-ArbeitsbereichTASTEZIPKomprimieren und EntpackenTASTEWINMDateiverwaltungEntwicklerwerkzeugeTASTECODEIntegrierte Entwicklungsumgebung für RustTASTESTUDIOIntegrierte Entwicklungs- und TestumgebungTASTEETLDatenintegration (ETL)ServerTASTEREMOTERemote-Desktop-ServerTASTEGEOGeodatenserverTASTEMAILE-Mail-ArbeitsbereichInvestierenTASTESTOCKDesktop-App für automatischen AktienhandelErste SchritteDownloadsDokumentationKaufenAlle Produkte
Marktplatz
Neuigkeiten
TechnikNeuigkeitenEntwickler-News von heuteEntwicklerdokuProgrammiersprachenRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp- & Desktop-FrameworksTauriFlutterReact NativeElectronAlgorithmenAlgorithmus-GrundlagenKernalgorithmenFortgeschrittene AlgorithmenAlgorithmen für die Praxis
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcaseCommunity-Leitfaden
ZusammenarbeitWissenstransferWebsite-AufbauDesktop-App-AufbauRelease- und ZahlungspipelineVertriebspartnerKontakt
DiensteRemote-DesktopIndividuelle Installationspakete
TASTEDEV
Produkte

Desktop-Werkzeuge

TASTECADKomplexe Zeichnungen, mühelos geöffnetTASTEFILESNur die Dateien, die zählen – in BestzeitTASTEFTPDer aufgeräumteste Weg für Ihre DateienTASTESSHDie stärkere Verbindung zu Ihren ServernTASTEZIPSchneller packen, sicherer entpackenTASTEWINMEin tastaturorientierter Dateimanager mit zwei Fenstern

Entwicklerwerkzeuge

TASTECODERust-Apps bearbeiten, bauen, debuggen und testen – alles in einem FensterTASTESTUDIOVom Bearbeiten bis zu Remote-Tests und freigegebenen KI-KorrekturenTASTEETLDaten bewegen, die Werte im Blick

Server

TASTEREMOTEEin Remote-Desktop auf Ihrem eigenen ServerTASTEGEOEin GeoServer-kompatibler Geodatenserver, neu aufgebaut in RustTASTEMAILIhre E-Mail wieder in Ihrer Hand

Investieren

TASTESTOCKAutomatischer Aktienhandel nach Ihren Regeln: wann und was

Erste Schritte

DownloadsNeueste Versionen aller ProdukteDokuSo nutzen Sie jedes ProduktKaufenAbos und DauerlizenzenAlle ProdukteAlle Produkte im Überblick
Alle Produkte
MarktplatzNeuigkeiten
Technik

Neuigkeiten

Entwickler-News von heuteOffizielle Meldungen zu Sprachen, Frameworks, GitHub und KIEntwicklerdokuAnleitungen zu Sprachen, Frameworks und Algorithmen

Programmiersprachen

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App- & Desktop-FrameworksTauriFlutterReact NativeElectron

Algorithmen

Algorithmus-GrundlagenKomplexitätsanalyse · Sortieren · Suchen · Grundlegende Datenstrukturen · Bäume und HeapsKernalgorithmenGraphtraversierung · Kürzeste Wege und minimale Spannbäume · Dynamische Programmierung · Greedy-Algorithmen · Teile und herrsche · BacktrackingFortgeschrittene AlgorithmenZeichenkettenalgorithmen · Mathematik und Zahlentheorie · Bitmanipulation · Segmentbäume · Union-FindAlgorithmen für die PraxisStrategie für Coding-Interviews · LRU-Cache · Rate Limiting · Konsistentes Hashing
Alle Entwicklungsdokumente
Community
ProjekteEntwickler und Projekte entdeckenEntwicklungslogsEntscheidungen und ErkenntnissePromptsWiederverwendbare AnweisungenProbleme mit KI-ToolsProbleme und Workarounds für Claude, Codex, GeminiShowcaseFertige ErgebnisseCommunity-LeitfadenWie wir offen entwickeln
Zusammenarbeit
WissenstransferNative Apps mit Rust und eguiWebsite-Aufbau10 Sprachen, Konten, Dokumentation und DownloadsDesktop-App-AufbauRust und egui, ohne WebViewRelease- und ZahlungspipelineSignatur, MSI, deb, rpm, AppImage, PrüfsummenVertriebspartnerEmpfehlen und 30 % erhaltenKontaktEntwicklung, Partnerschaft, Investition
Dienste
Remote-DesktopIhren Computer im Browser erreichenIndividuelle InstallationspaketeNur nötige Funktionen, Einstellungen vorab
Kaufen
DE
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Anmelden
Anmelden
TASTEDEV

Von kleinen Werkzeugen zu besserer Entwicklung.

support@tastedev.netTASTEDEV unterstützen
ProdukteProduktübersichtKaufenDokuDownloadsMarktplatzSupport
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcase
RichtlinienÜber unsDatenschutzerklärungNutzungsbedingungenAbo-BedingungenRückerstattungCommunity-Richtlinien
KontoAnmeldenRegistrieren
Besucher
Heute
Gestern
Aufrufe gesamt
Firma
GXSOFT
Vertretungsberechtigt
CHOI YOUNG GU
Handelsregisternummer
853-44-00368
Anschrift
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefon
+82-10-4404-1523
E-Mail
whitecalvin@tastedev.net
Datenschutzbeauftragter
CHOI YOUNG GU

© 2026 TASTEDEVProduktinformationen basieren auf verifizierten Entwicklungsquellen.Veröffentlicht · wird verbessert

JavaScript-Dokumentation
JavaScript
Getting StartedSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts: Async and Closures
Diskussionen

JavaScript-Anleitung · 4/6

Modules and Packages

Dieses Kapitel ist vorerst nur auf Englisch verfügbar.

As a program grows you split it into files and pull in libraries written by others. JavaScript has two module systems: the standard ES modules (ESM) and CommonJS, which Node.js used for years before ESM existed. This chapter compares them and then covers npm, package.json, scripts and the basics of bundling.

ES modules

ES modules are part of the language standard and work in both browsers and Node.js. You export from one file and import in another. A file can have many named exports but only one default export.

// math.js
export const PI = 3.14159;

export function circleArea(r) {
  return PI * r * r;
}

export default function sum(...nums) {
  return nums.reduce((a, b) => a + b, 0);
}
// main.js
import sum, { circleArea, PI as pi } from "./math.js";
import * as math from "./math.js";

console.log(sum(1, 2, 3));  // 6
console.log(circleArea(2)); // 12.56636
console.log(pi === math.PI); // true

// dynamic import loads on demand and returns a Promise
const { readFile } = await import("node:fs/promises");

A few things set ES modules apart:

  • They always run in strict mode.
  • Static import declarations let tools drop unused code (tree shaking).
  • Top-level await is allowed.
  • In the browser you load them with <script type="module" src="main.js">, and relative imports must include the .js extension.

CommonJS

CommonJS uses require and module.exports. You will still meet it in plenty of packages and older projects.

// greet.cjs
function greet(name) {
  return `Hello, ${name}`;
}
module.exports = { greet };

// app.cjs
const { greet } = require("./greet.cjs");
const path = require("node:path");

console.log(greet("Mina"));
console.log(path.join("logs", "today.txt"));

Node.js decides how to treat a file with these rules:

FileTreated as
.mjsES module
.cjsCommonJS
.js with "type": "module" in the nearest package.jsonES module
.js with no "type" or "commonjs"CommonJS

For new projects, set "type": "module" and write ESM. ES modules can import CommonJS packages; going the other way, a dynamic import() is the most reliable route. Prefix built-ins with node: (, ) so they never get confused with npm packages.

Fragen zu diesem Kapitel?
Vorheriges KapitelTypes and DataNächstes KapitelErrors and Testing
node:fs
node:path

npm and package.json

npm downloads packages into node_modules and records each one, with an allowed version range, in package.json.

npm install zod          # runtime dependency
npm install -D vitest    # development-only dependency
npm uninstall zod
npm outdated             # list packages with newer releases
npm ci                   # clean install straight from the lock file (for CI)
{
  "name": "todo-api",
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "start": "node src/server.js",
    "dev": "node --watch src/server.js",
    "test": "node --test"
  },
  "dependencies": {
    "zod": "^3.23.0"
  },
  "devDependencies": {
    "vitest": "^2.0.0"
  }
}

A caret (^) allows newer minor and patch releases within the same major version; a tilde (~) allows only patch releases. The exact versions actually installed land in package-lock.json, so committing it keeps teammates and servers in sync.

Running scripts

Anything under scripts runs with npm run <name>. start and test also have shortcuts. Inside a script, tools installed in node_modules/.bin are available without a path.

npm run dev
npm test
npm start

# run a tool once without adding it to the project
npx prettier --write src

Bundling basics

Browser apps quickly grow to hundreds of files plus npm dependencies. A bundler follows the imports, combines everything into one or a few files, and handles minification, tree shaking and code splitting along the way.

ToolKnown for
ViteFast dev server and minimal config; a common default for new apps
esbuildExtremely fast bundling and transforms
RollupClean output for publishing libraries
webpackLong track record and a huge plugin ecosystem
# scaffold a new project with Vite
npm create vite@latest my-web

# bundle and minify a single entry with esbuild
npx esbuild src/main.js --bundle --minify --outfile=dist/app.js

Server code that only runs on Node.js usually works fine unbundled. Bundlers matter most for code you ship to browsers.

Summary

  • Write new code as ES modules and set "type": "module" in package.json.
  • Expect to keep reading CommonJS (require, module.exports) in older code.
  • Separate dependencies from devDependencies and commit package-lock.json.
  • Put repeated commands in scripts and run them with npm run.
  • Use a bundler such as Vite or esbuild for browser code.

0 Kommentare

Top-KommentareNeueste zuerst

Anmelden · Melde dich an, um einen Kommentar zu schreiben.