Primiano Tucci | 94c47f0 | 2019-12-05 03:13:11 +0000 | [diff] [blame] | 1 | // Copyright (C) 2018 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 15 | import commonjs from 'rollup-plugin-commonjs'; |
| 16 | import nodeResolve from 'rollup-plugin-node-resolve'; |
| 17 | |
| 18 | export default { |
Hector Dearman | 03f962c | 2018-08-09 17:00:32 +0100 | [diff] [blame] | 19 | output: {name: 'perfetto'}, |
Hector Dearman | 1ed33e6 | 2019-08-05 11:59:03 +0100 | [diff] [blame] | 20 | plugins: |
| 21 | [ |
| 22 | nodeResolve({ |
| 23 | mainFields: ['browser'], |
| 24 | browser: true, |
Nicolò Mazzucato | ff51467 | 2019-08-08 12:00:32 +0100 | [diff] [blame] | 25 | preferBuiltins: false, |
Hector Dearman | 1ed33e6 | 2019-08-05 11:59:03 +0100 | [diff] [blame] | 26 | }), |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 27 | |
Hector Dearman | 1ed33e6 | 2019-08-05 11:59:03 +0100 | [diff] [blame] | 28 | // emscripten conditionally executes require('fs') (likewise for |
| 29 | // others), when running under node. Rollup can't find those libraries |
| 30 | // so expects these to be present in the global scope, which then fails |
| 31 | // at runtime. To avoid this we ignore require('fs') and the like. |
| 32 | commonjs({ |
| 33 | ignore: [ |
| 34 | 'fs', |
| 35 | 'path', |
| 36 | 'crypto', |
| 37 | ] |
| 38 | }), |
Nicolò Mazzucato | ff51467 | 2019-08-08 12:00:32 +0100 | [diff] [blame] | 39 | ], |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 40 | } |