switched to esbuild for build:dev

added watch mode
slightly changed the start command
This commit is contained in:
Milos Brzakovic (E-Search)
2021-10-26 17:16:46 +02:00
parent 810ce60c18
commit b15897cca7
3 changed files with 7 additions and 44 deletions

1
.gitignore vendored
View File

@@ -12,6 +12,7 @@ transifex.auth
/dist/*.js
/dist/*.css
/dist/*.map
/dist/*.json
/dist/data/
/dist/img/*.svg
/dist/mapillary-js/

View File

@@ -1,41 +0,0 @@
/* eslint-disable no-console */
import commonjs from '@rollup/plugin-commonjs';
import includePaths from 'rollup-plugin-includepaths';
import json from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import progress from 'rollup-plugin-progress';
// The "dev" build includes all modules in a single bundle - for now
// * Skips transpilation (so it includes ES6 code and must run in a modern browser)
// * Also generates sourcemaps
export default {
input: './modules/id.js',
onwarn: onWarn,
output: {
file: 'dist/iD.js',
format: 'iife',
sourcemap: true,
strict: false
},
plugins: [
progress(),
includePaths({
paths: ['node_modules/d3/node_modules'] // npm2 or windows
}),
nodeResolve({ dedupe: ['object-inspect'] }),
commonjs(),
json({ indent: '' })
]
};
function onWarn(warning, warn) {
// skip certain warnings
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
if (warning.code === 'EVAL') return;
// Use default for everything else
console.log(warning.code);
warn(warning);
}

View File

@@ -16,7 +16,8 @@
"build": "npm-run-all -s build:css build:data build:dev",
"build:css": "node scripts/build_css.js",
"build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
"build:dev": "rollup --config config/rollup.config.dev.js",
"build:dev": "esbuild ./modules/id.js --outfile=dist/iD.js --bundle --metafile=dist/esbuild.json",
"build:dev:watch": "esbuild ./modules/id.js --outfile=dist/iD.js --bundle --metafile=dist/esbuild.json --watch",
"build:legacy": "rollup --config config/rollup.config.legacy.js",
"build:stats": "rollup --config config/rollup.config.stats.js",
"clean": "shx rm -f dist/*.js dist/*.map dist/*.css dist/img/*.svg",
@@ -34,8 +35,9 @@
"imagery": "node scripts/update_imagery.js",
"lint": "eslint scripts test/spec modules",
"lint:fix": "eslint scripts test/spec modules --fix",
"start": "npm-run-all -s build start:server",
"quickstart": "npm-run-all -s build:dev start:server",
"start": "npm-run-all -s build:dev start:server",
"start:watch": "npm-run-all -p build:dev:watch start:server",
"start:extented": "npm-run-all -s build start:server",
"start:server": "node scripts/server.js",
"test": "npm-run-all -s lint build:css build:data build:legacy test:spec",
"test:spec": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec",
@@ -54,6 +56,7 @@
"alif-toolkit": "^1.2.9",
"core-js": "^3.6.5",
"diacritics": "1.3.0",
"esbuild": "^0.13.9",
"fast-deep-equal": "~3.1.1",
"fast-json-stable-stringify": "2.1.0",
"lodash-es": "~4.17.15",