• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import commonjs from 'rollup-plugin-commonjs';
16import nodeResolve from 'rollup-plugin-node-resolve';
17
18export default {
19  output: {name: 'perfetto'},
20  plugins:
21      [
22        nodeResolve({
23          mainFields: ['browser'],
24          browser: true,
25          preferBuiltins: false,
26        }),
27
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        }),
39      ],
40}
41