|
1 | | -var glsl = require('esbuild-plugin-glsl').glsl; |
2 | | -var environmentPlugin = require('esbuild-plugin-environment').environmentPlugin; |
| 1 | +const { environmentPlugin } = require('esbuild-plugin-environment'); |
| 2 | +const { glsl } = require('esbuild-plugin-glsl'); |
3 | 3 | const InlineCSSPlugin = require('esbuild-plugin-inline-css'); |
| 4 | +const path = require('path'); |
| 5 | +const constants = require('./tasks/util/constants.js'); |
4 | 6 |
|
5 | | -module.exports = { |
| 7 | +// Default config used when building library |
| 8 | +const esbuildConfig = { |
6 | 9 | entryPoints: ['./lib/index.js'], |
7 | 10 | format: 'iife', |
8 | 11 | globalName: 'Plotly', |
9 | 12 | bundle: true, |
10 | 13 | minify: false, |
11 | 14 | sourcemap: false, |
12 | | - plugins: [ |
13 | | - InlineCSSPlugin(), |
14 | | - glsl({ |
15 | | - minify: true, |
16 | | - }), |
17 | | - environmentPlugin({ |
18 | | - NODE_DEBUG: false, |
19 | | - }), |
20 | | - ], |
| 15 | + plugins: [InlineCSSPlugin(), glsl({ minify: true }), environmentPlugin({ NODE_DEBUG: false })], |
21 | 16 | alias: { |
22 | | - stream: 'stream-browserify', |
| 17 | + stream: 'stream-browserify' |
23 | 18 | }, |
24 | 19 | define: { |
25 | 20 | global: 'window', |
26 | | - 'define.amd': 'false', |
| 21 | + 'define.amd': 'false' |
27 | 22 | }, |
28 | 23 | target: 'es2016', |
29 | | - logLevel: 'info', |
| 24 | + logLevel: 'info' |
| 25 | +}; |
| 26 | + |
| 27 | +const devtoolsConfig = { |
| 28 | + entryPoints: [path.join(constants.pathToRoot, 'devtools', 'test_dashboard', 'devtools.js')], |
| 29 | + outfile: path.join(constants.pathToRoot, 'build', 'test_dashboard-bundle.js'), |
| 30 | + format: 'cjs', |
| 31 | + globalName: 'Tabs', |
| 32 | + bundle: true, |
| 33 | + minify: false, |
| 34 | + sourcemap: false, |
| 35 | + plugins: [glsl({ minify: true })], |
| 36 | + define: { global: 'window' }, |
| 37 | + target: 'es2016', |
| 38 | + logLevel: 'info' |
| 39 | +}; |
| 40 | + |
| 41 | +const localDevConfig = { |
| 42 | + ...esbuildConfig, |
| 43 | + outfile: './build/plotly.js' |
| 44 | +}; |
| 45 | + |
| 46 | +const localDevReglCodegenConfig = { |
| 47 | + ...esbuildConfig, |
| 48 | + entryPoints: [path.join(constants.pathToRoot, 'devtools/regl_codegen', 'devtools.js')], |
| 49 | + outfile: './build/regl_codegen-bundle.js', |
| 50 | + sourcemap: false, |
| 51 | + minify: false |
| 52 | +}; |
| 53 | + |
| 54 | +module.exports = { |
| 55 | + devtoolsConfig, |
| 56 | + esbuildConfig, |
| 57 | + localDevConfig, |
| 58 | + localDevReglCodegenConfig, |
30 | 59 | }; |
0 commit comments