Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 1 | import commonjs from 'rollup-plugin-commonjs'; |
| 2 | import nodeResolve from 'rollup-plugin-node-resolve'; |
Hector Dearman | 5ae8247 | 2018-10-03 08:30:35 +0100 | [diff] [blame] | 3 | import replace from 'rollup-plugin-replace'; |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 4 | |
| 5 | export default { |
Hector Dearman | 03f962c | 2018-08-09 17:00:32 +0100 | [diff] [blame] | 6 | output: {name: 'perfetto'}, |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 7 | plugins: [ |
Hector Dearman | 03f962c | 2018-08-09 17:00:32 +0100 | [diff] [blame] | 8 | nodeResolve({browser: true}), |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 9 | |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 10 | // emscripten conditionally executes require('fs') (likewise for others), |
| 11 | // when running under node. Rollup can't find those libraries so expects |
| 12 | // these to be present in the global scope, which then fails at runtime. |
| 13 | // To avoid this we ignore require('fs') and the like. |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 14 | commonjs({ |
| 15 | ignore: [ |
| 16 | 'fs', |
Hector Dearman | 03f962c | 2018-08-09 17:00:32 +0100 | [diff] [blame] | 17 | 'path', |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 18 | 'crypto', |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 19 | ] |
Hector Dearman | 5ae8247 | 2018-10-03 08:30:35 +0100 | [diff] [blame] | 20 | }), |
| 21 | |
| 22 | replace({ |
| 23 | 'immer_1.produce': 'immer_1', |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 24 | }) |
Hector Dearman | 5ae8247 | 2018-10-03 08:30:35 +0100 | [diff] [blame] | 25 | |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 26 | ] |
| 27 | } |