aboutsummaryrefslogtreecommitdiffhomepage
path: root/rollup.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'rollup.config.js')
-rw-r--r--rollup.config.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/rollup.config.js b/rollup.config.js
index 145224b..f5a22eb 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -13,12 +13,12 @@ const general = {
13 dir: './dist', 13 dir: './dist',
14 format: 'esm', 14 format: 'esm',
15 entryFileNames: '[name].mjs', 15 entryFileNames: '[name].mjs',
16 sourcemap: 'true' 16 sourcemap: 'true',
17 } 17 },
18 ], 18 ],
19 watch: { 19 watch: {
20 clearScreen: false, 20 clearScreen: false,
21 include: ['src/**', 'mapclay/dist/mapclay.mjs'] 21 include: ['src/**', 'mapclay/dist/mapclay.mjs'],
22 }, 22 },
23 context: 'window', 23 context: 'window',
24 plugins: [ 24 plugins: [
@@ -26,13 +26,12 @@ const general = {
26 name: 'watch-mapclay', 26 name: 'watch-mapclay',
27 buildStart () { 27 buildStart () {
28 const mapclayPath = join(process.cwd(), 'mapclay', 'dist', 'mapclay.mjs') 28 const mapclayPath = join(process.cwd(), 'mapclay', 'dist', 'mapclay.mjs')
29 console.log('Watching:', mapclayPath)
30 if (existsSync(mapclayPath)) { 29 if (existsSync(mapclayPath)) {
31 this.addWatchFile(mapclayPath) 30 this.addWatchFile(mapclayPath)
32 } else { 31 } else {
33 console.log('mapclay.mjs not found at:', mapclayPath) 32 console.warn('mapclay.mjs not found at:', mapclayPath)
34 } 33 }
35 } 34 },
36 }, 35 },
37 { 36 {
38 name: 'leader-line', 37 name: 'leader-line',
@@ -41,7 +40,7 @@ const general = {
41 return `${code}\nexport default LeaderLine;` 40 return `${code}\nexport default LeaderLine;`
42 } 41 }
43 return null 42 return null
44 } 43 },
45 }, 44 },
46 { 45 {
47 name: 'mapclay', 46 name: 'mapclay',
@@ -50,24 +49,24 @@ const general = {
50 return './mapclay/dist/mapclay.mjs' 49 return './mapclay/dist/mapclay.mjs'
51 } 50 }
52 return null 51 return null
53 } 52 },
54 }, 53 },
55 node(), 54 node(),
56 commonjs(), 55 commonjs(),
57 production && terser({ 56 production && terser({
58 keep_fnames: true 57 keep_fnames: true,
59 }), 58 }),
60 production && bundleStats() 59 production && bundleStats(),
61 ] 60 ],
62} 61}
63 62
64export default [ 63export default [
65 { 64 {
66 input: 'src/editor.mjs' 65 input: 'src/editor.mjs',
67 }, 66 },
68 { 67 {
69 input: 'src/dumbymap.mjs' 68 input: 'src/dumbymap.mjs',
70 } 69 },
71] 70]
72 .map(config => ({ ...general, ...config })) 71 .map(config => ({ ...general, ...config }))
73 .filter((config) => production || config.input.match(/editor/)) 72 .filter((config) => production || config.input.match(/editor/))